Skip to main content

Hide and Show Elements with jQuery

By Sam Deering



Free JavaScript Book!

Write powerful, clean and maintainable JavaScript.

RRP $11.95

With jQuery you can hide and show page elements very easily. The page elements can be anything such as a div, an image, a paragraph or anything that is on your webpage really.

This is how you do it:

$(this).hide() //hides current element

$("p").hide() //hides all paragraphs

$("p.test").hide() //hides all paragraphs

$("#test").hide() //hides the element with id="test"

Live demos:


Sam Deering has 15+ years of programming and website development experience. He was a website consultant at Console, ABC News, Flight Centre, Sapient Nitro, and the QLD Government and runs a tech blog with over 1 million views per month. Currently, Sam is the Founder of Crypto News, Australia.

New books out now!

Learn valuable skills with a practical introduction to Python programming!

Give yourself more options and write higher quality CSS with CSS Optimization Basics.