Search code examples
eventsjquerymouseoverattachmentmouseclick-event

How to attach mouse over event in the given code?


I am trying to use http://demo.tutorialzine.com/2011/06/beautiful-portfolio-html5-jquery/ which is having a tutorial page @ http://tutorialzine.com/2011/06/beautiful-portfolio-html5-jquery/

I want to add mouse over event or click event, but my code is not working.

$("ul#stage li").click(function() {
    alert("Over")

});

I added the event in document ready function, but not working. Please help. I tried similar code for 'hover' event.


Solution

  • $("ul#stage li").live('click', function() {
        alert("Over")
    
    });
    

    or for both events

    $("ul#stage li").live({
      click: function() {
        // do something on click
      },
      mouseover: function() {
        // do something on mouseover
      }
    });