javascript - jQuery Show/Hide Question -
I'm just trying to prepare a very simple jQuery action.
I have two components: # security
and # security-tab one
, hidden on # security
should go. When a link is clicked in #Sit-tab
, then it will be hide
and slideUp
to be #safety
.
This works, but the #safety
box just does not show Flickr when clicking:
$ (document). $ ("(Security") {$ ("security-tab A"). (Function () {$ (this) .hide (); $ ("# security"). RemoveClass ("hide");} );});
This is the markup:
Any thoughts that I am doing wrong?
add return false;
or event.preventDefault ()
on your click handler Click <$> $ {$ (this) .hide (); $ (" #Security "). RemoveClass (" hide "); event.preventDefault ();});});
This & lt; A & gt;
prevents the default behavior of the element, which is reloading the page. Event Bubble will be preserved by using event.preventDefault () which is sometimes necessary.
return false;
Default behavior, but this will also prevent bubbling.
Comments
Post a Comment