How do you fix a headphone jack?

I had the exact same problem If your headphones jack doesn't work but your speakers do, Here's how you fix it First, check windows updates and install any missing drivers. Then restart it ONLY when windows update tells you to. Dont attempt to turn your computer off during startup just let it finish updating. then when your computer has finished logging in it should work.
If it doesnt, go to control panel then sound and select headphone and click install.

If it says headphones not plugged in the is another alternative but only do it if you're completely out of warranty and if you know what you're doing you can open your laptop (i suggest you find a manual online) get a soldering iron and open the headphones jack from the inside and shift the solder wires back into place if the wires are cut, or you do not know how to do it, i suggest you find a technician

Hope this helped (: