Hi everyone
I'm using JQuery to add an onClick event to all DIV tags on my HTML page
Here's the code:
This code works fine but the problem is that I only need DIV tags which have a class attribute.
for Example :
In the above code only first and third DIVs should be selected
Thanks / Behzad
I'm using JQuery to add an onClick event to all DIV tags on my HTML page
Here's the code:
Code:
$(document).ready(function(){
var js = "alert(this.className); return false;";
var newclick = new Function(js);
$("div").attr('onclick', '').click(newclick);
});
for Example :
Code:
<div class='test1'></div> <div></div> <div class='test2'></div>
Thanks / Behzad
Comment