I’m new to JQuery/Javascript etc… based on the following article:
How to make an anchor tag refer to nothing?
I would like to apply the java function to several id’s. Can we not make the function execute for classes as opposed to ids?
<span class="style1" id="myid">Link</span>
<span class="style1" id="myid">Link</span>
<span class="style1" id="myid">Link</span>
<span class="style1" id="myid">Link</span>
<span class="style1" id="myid">Link</span>
$('myid').click(function() {
/* put your code here */
});
Basically as above, how do I execute the function above for ALL of the links? Is this possible? Thanks in advance.
Use the following
This adds a click handler to all elements with class containing
style1. You should not have duplicate IDs