Sunday, 8 September 2013

I can't write a switch to show and hide an element?

I can't write a switch to show and hide an element?

I want to write a switch to hide and show an element with the following code:
.hidden {
display:none;
}
<input type='text' id='other_elem' class='hidden' />
$('#elem').click(function(){
if($('#other_elem').is('display'))
$('#other_elem').hide();
else
$('#other_elem').show();
});
I successfully show the hidden text field when I click on the button but I
can't hide it when it is appear. So, can some one provide me some hints?
thank you!

No comments:

Post a Comment