make onmouseenter and onmouseleave to work in chrome - html, javascript, jquery -


<div style="position: relative; left: 50px; top: 30px; width: 300px; height: 150px; background: #222222;" onmouseenter="this.style.background='#aaaaaa'" onmouseleave="this.style.background='#222222';"></div> 

http://jsfiddle.net/z8kue/1/

onmouseenter , onmouseleave events works in firefox , opera, apparently doesn't work @ in chrome...

how can simple basic div in fiddle become functional in chrome, without changing it's content (beside assigning class)?

the ideal solution, if possible, somehow register onmouseenter , onmouseleave events chrome users, without assigning class.

edit: know onmouseover , onmouseout, out of question - need workaround code have practical reasons.

edit 2: right have jquery specific class - http://jsfiddle.net/z8kue/6/. have lot of divs it's events written in html, inside of <div></div>

so example, have 2 divs these (http://jsfiddle.net/z8kue/8/). imagine there 200 divs instead , lot more variety in events. how can handled work in chrome jquery in practical way? (definitely not erasing content 200 divs , writing jquery 200 or more lines)

working demo

you jquery

code

$('div').mouseenter(function () {     $(this).css('background', '#aaaaaa'); }); $('div').mouseleave(function () {     $(this).css('background','#222222'); }); 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -