html5 - Selecting multiple id's and hovering using jquery each() and hover() -


please kindly take @ code. i'm selecting element same ids, however, first element changes color, when hover on other elements, color remain same. not sure if i'm doing right way.. please kindly offer suggestions.

a life demo here -> http://jsfiddle.net/bwoodlt/2rece/

    $(document).ready(function(){         $("#ade").live("hover", function(){             $("#ade").each(function (){             $(this).toggleclass('highlight');            // alert("in here..")         });          });     }); 

update:

thanks guys! did use class selector, selects elements on-hover! want select each element on hover, proceed next element, should change color rather selecting element , changing color when 1 item hovered!

as stated, ids must unique. also, code doesn't make sense anyway. when hover on div, loop through every other div, , apply highlighted class each div. surely want add highlighted class hovered div? in case, drop .each(). , don't use .live(), it's deprecated. use .hover() if need to, or if need delegated events, use .on().

$(".ade").hover(function(){     $(this).toggleclass('highlight'); }); 

jsfiddle: http://jsfiddle.net/2rece/2/


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -