jQuery mouseover not working for li element -
i'm trying make menu based on ul element show link description underneath link.
so far, have following code (simplified little)
echo ' <script> $("#menu_1").mouseover(function() { $("#description").replacewith("test"); }); </script> <ul class="menu_top"> <li id="menu_1"><a href = "#">test</a></li> </ul> <div id="description" class="menu_desc"> </div> ';
however, everytime move mouse on li element, nothing happens.
does know i'm doing wrong?
javascript code executed encountered. might happen before document ready. in case, you're trying select #menu_1
element before exists in document. because want jquery code run after document ready, jquery provides shortcut method you:
$(function () { // code run after whole document ready go $("#menu_1")... });
Comments
Post a Comment