onclick - jquery ID select depending on user click of URL -
here mycode:
$(document).ready(function() { $("#mylink1").click(function(){ foo bar... }); }); <a href = "#" id="mylink1"> click link <a> <a href = "#" id="mylink2"> click link2 <a> <a href = "#" id="mylink3"> click link3 <a>
for first 1 fine, instead of repeating code, how can capture user clicked, if user clicked 2 or 3 #mylink1 has how replaced there generic way??? please help me
use id
$(document).ready(function() { $(".your-class").click(function(){ alert(this.id); }); }); <a href = "#" class="your-class" id="mylink1"> click link </a> <a href = "#" class="your-class" id="mylink2"> click link2 </a> <a href = "#" class="your-class" id="mylink3"> click link3 </a>
jquery onclick user capture
No comments:
Post a Comment