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">&nbsp; </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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -