So today I was creating a checkbox element in jQuery when I noticed
that I had a typo in my code..  I had declared the initial tags as:

var checkbox = $('<input></input');

Totally forgetting to append the last '>' symbol at the end of the
closing tag.  I was surprised to find that this hadn't thrown some
kind of error or hadn't caused unwanted behavior in my checkbox when
the page was rendered.  when I corrected the problem though, something
really odd happened.  I ended up with the error below in Firebug and
the whole page crashed:

[Exception... "'type property can't be changed' when calling method:
[nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]  in
jquery.js line 2869

Seems that attempting to change the attributes on the new object was
failing now that the correct syntax was in place.  When I replaced the
typo by removing the '>' sign, the error went away and everything was
fine again.  I did some investigation and found the following worked
fine as well:

var checkbox = $('<input>');
$(checkbox).attr('type', 'checkbox');

and

var checkbox = $('<input/>');
$(checkbox).attr('type', 'checkbox');

The only time the problem shows up, is when I use the tag declaration $
('<input></input>');

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to