jquery - Adding e.preventDefault(); to disable anchor behavior broke function -
jquery - Adding e.preventDefault(); to disable anchor behavior broke function -
i'm pretty stumped on because seems simple. took function:
$('#nav-link-1').click(function(){ $('#nav-pulldown-div-1').slidetoggle(); });
...and changed (in line i've seen other people doing disable anchor's default behavior):
$('#nav-link-1').click(function(e){ e.preventdefault(); $('#nav-pulldown-div-1').slidetoggle(); });
...and stopped working. (the nav-pulldown-div-# divs should toggle view when link clicked.) i'm still not versed jquery, can imagine i'm overlooking simple.
edit: here's jsfiddle: http://jsfiddle.net/grbyz/2/
i know it's weird there's links 2 , 3, there's reason in design.
there typo on fiddle. missing .
in
$('#nav-link-3').click(function(e) { $('#nav-pulldown-div-3').slidetoggle(); e.preventdefault(); });
jquery
Comments
Post a Comment