Firstly, your HP printer should be connected to a working internet connection through the Ethernet cable or wirelessly.
Secondly, both your printer and computer should be connection to the same internet network.
How to setup the printer on your wireless network?
Go to the 123.hp.com/setup HP printer’s control panel display screen and scroll through the options. Touch the Setup option.
From the available options, select Network Setup
Now, choose Wireless Settings from the available options.
A new set of options will be displayed in front of you, tap on Wireless Setup Wizard.
Follow the prompts displayed on the printer screen to complete the 123.hp.com/setup process.