I have 2 anchor tags like this
<a href="#" id="1">1</a>
<a href="#" id="2" style="display:none;">2</a>
and Jquery functions like this
$(document).ready(function (){
$('#1').click(function(){ //code to show div 1 //code to hide div 2
}); $('#2').click(function(){ //code to show div 2 //code to hide div 1 });
});
Problem is when I click on "2" anchor tag, second div tag displays then when I want to again display div 1 by clicking "1" anchor tag it doesn't work. It's like after running 2nd function 1st function doesn't exist!
Updating Question with answer: I changed the selectors to like ques-1, ques-2 and if there are two selectors with same name jquery calls only first selector, so better give selector different names even if one of them is gonna be active one at a time