php - using jQuery affects all my content -



php - using jQuery affects all my content -

i utilize code load links jquery. applies <a></a>. how skip of <a></a> script?

$("a").on("click", function(e) { e.preventdefault(); var sectionid = '#'+ $(this).data("section"); $("#content section:visible").fadeout('normal'); $(sectionid).fadein('normal'); }); });

there 2 ways accomplish goal.

1 . opt in links:

<a href="#" class="special test foo">function execute</a> <a href="#" class="special">function execute</a> <a href="#" class="special">function execute</a> <a href="#" class="bar special">function execute</a> <a href="#">function not execute</a> <a href="#" class="foo">function not execute</a>

js:

$("a.special").on("click", function(e) { e.preventdefault(); var sectionid = '#'+ $(this).data("section"); $("#content section:visible").fadeout('normal'); $(sectionid).fadein('normal'); }); });

2 . opt out links:

<a href="#" class="noshow">function not execute</a> <a href="#" class="noshow test">function not execute</a> <a href="#">function execute</a> <a href="#" class="bar">function execute</a>

js:

$("a").not('.noshow').on("click", function(e) { e.preventdefault(); var sectionid = '#'+ $(this).data("section"); $("#content section:visible").fadeout('normal'); $(sectionid).fadein('normal'); }); });

php jquery

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -