tags:

views:

45

answers:

2

Hi,

i try to get a json list and append it

$.getJSON("url",
        function(data){
        $('#tbl').append("<li id="listitem">asd</li>);
        });

It works but i cant access the li object with

$("#listitem").hover( alert("Hover"); );

`

A: 

Try with livequery plugin. It should help in these case. Try something like this:

$('#tbl').append("<li id="listitem">asd</li>).livequery( 'hover', doMagic() );
matma
thanks livequery solved it :-)$('a') .livequery('click', function(event) { alert('clicked'); return false; });
Huzzel
+1  A: 

This should work

$("#listitem").hover( function() {alert("Hover");} );

hover expects an anonymous function or a callback.

RamboNo5