Running as re-usable code.
Can you tell me how I can get this piece of code to run when the link is pressed on both pages:
I know I could do it with the following:
- $("#"+a0+" .btnCode").click(function(){
- alert("I've been pressed From: "+a0+" - "+$(this).attr("href"));
- });
-
- $(".btnCode").click(function(){
- alert("I've been pressed From: "+a0+" - "+$(this).attr("href"));
- });
But as this is used many times I thought it might be easier using something like the former.
Many thanks.