I don't think it'll work because there is no ELEMENT called ".test". '<div class="test">click does not work</div>' is treated as a string and isn't converted into the DOM.
Consider changing you "#trigger".click() to instead create a DOM element and add DOM text to it. Eg. $("#trigger").click(function(){ var div = document.createElement('div'); div.className = 'test'; div.appendChild(document.createTextNode('click does not work')); $("#content").append(div); return false; }); Laurent Goussard wrote: > Hi there, > > I'm trying a very simple (in my opinion) use of jQuery, but I can't > figure how I am suppose to make it work. > Can someone explain me how enabling the click event on .test even if > the .test element is loaded dynamically from script (ajax doesn't work > neither) ? > > - - - - > <script type="text/javascript"> > $(document).ready(function(){ > $(".test").click(function(){ > alert("yeepee"); > }); > $("#trigger").click(function(){ > $("#content").append('<div class="test">click does not > work</div>'); > return false; > }); > }); > </script> > (...) > <a href="http://www.site.com/" id="trigger">click</a> > <div id="content">dummy content</div> > (...) > - - - - > > Thank you, > > Laurent > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/