javascript - a SPAN within A (HREF) -


i have span function display div on onclick, within (href), clicking, performs function, , after go site (href), has no way click on span, perform function, , not go page of (href) ?

<a class="style" href="http://stackoverflow.com/">     <span onclick="javascript:display('div1');">\/</span>     stack overflow </a> 

sorry bad english.

you may need use jquery magic here.

<a class="style" href="http://stackoverflow.com/">     <span id="inner-button">\/</span>     stack overflow </a> 

with js:

$('a').click(function(e) {     if (e.target.id == 'inner-button') {       // display div.        e.preventdefault();     } }); 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -