Set the mouseover Attribute of a div using JQuery
Posted
by Abs
on Stack Overflow
See other posts from Stack Overflow
or by Abs
Published on 2010-05-22T17:35:58Z
Indexed on
2010/05/22
17:40 UTC
Read the original article
Hit count: 180
JavaScript
|jQuery
Hello all,
I would like to set an attribute for a div. I have done this:
$('#row-img_1').onmouseover = function (){ alert('foo'); };
$('#row-img_2').onmouseout = function (){ alert('foo2'); };
However, the above has not worked, it does not alert when mouse is over or when it moves out.
I have also tried the $('#row-img_1').attr();
and I could not get this to work either.
I am aware that I should be using a more effective event handling system but my divs are dynamically generated. Plus this is a small project. ;)
Thanks all for any help.
© Stack Overflow or respective owner