This won't help your problem at all, but I would also like to add that I've
found exceptions in IE6 when adding css attributes to an element  that
hasn't still been attached to the DOM, i.e:

var elem = $("<li>").css("color", "red");

I don't know if these problems are still present in the new release 1.1.2.

Abel.

On 3/1/07, Weaver, Scott <[EMAIL PROTECTED]> wrote:

I noticed somewhat odd behavior when using .click() on newly created
elements.  If the .click() is assigned prior to the element being
attached to the DOM, the element behaves as if there is no event bound
to it.

var removeLink = $("<a href='#'>Remove</a>").click(function()
{alert('hello');});
$(".portlet .handle").append(removeLink);

Tested this in both FF 1.5 and IE6 and the event appears to have never
been bound to the element.

However, this works fine:

var removeLink = $("<a href='#'>Remove</a>");
$(".portlet .handle").append(removeLink);
$(".portlet .handle a").click(function() {alert('hello');});;

Is this expected behavior?  It is not a big deal at all though it did
cost me a bit of time earlier this morning try to figure why things
weren't working.  If this is expected behavior a short note/warning in
event docs would be nice :)

Regards,
-scott

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to