Gareth Compton Gareth Compton - 1 month ago 5x
Javascript Question

Jquery Selecting to hide and show issue: More than two elements

recently trying to make working pages to show and hide each element according to button, but I am somehow missing something to make this work, or somehow it isnt working at all.

When i run this example, the first two "A" links work, but not the third, is there a way to actually seperate it to where each element shows singular while hiding the rest?

Here is my coding:

<!DOCTYPE html>
<script src=""> </script>
$("p").hide(); //to hide all P elem for user to start
$("p#1").hide(); //Yes i tried grouping by selectors
$("p#3").hide(); //and also seperating like this
}); //but both didnt work :(
<div>please select a button to begin
<br />
<br />
<p id="1">If you click on the "Hide" button, I will disappear.</p>
<p id="2">If you click on the "Show" button, i will disappear!</p>
<p id="3">yay, another one</p>

<a id="hide">Hide</a>
<a id="show">Show</a>
<a id="third">other</a>


You need to replace this: