Side navigation
#2465 closed feature (invalid)
Opened March 06, 2008 05:23AM UTC
Closed March 10, 2008 01:39AM UTC
get dom element for added html
Reported by: | jablko | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.4 |
Component: | core | Version: | 1.2.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Thank you for jQuery, it's an ingenious library : )
I frequently use jQuery to add markup to a page:
$('#foo').before('<div>bar</div>');
However I now need to access the dom element which jQuery constructs (I'm building a YUI button by passing the dom element to the button constructor).
I wish there were a way to access the dom element which jQuery constructs. For now, I use:
var bar = jQuery.clean('<div>bar</div>');
$('#foo').before(bar);
var button = new YAHOO.widget.Button(bar);
- however I guess
clean
is not a documented jQuery function, and so may disappear at any point?
So again, unless there's a better way to accomplish this, I whish jQuery exposed the function it uses to construct a dom element from an html string.
Also, I guess when ECMAScript for XML (E4X) is widely supported, I could use that, but until then, jQuery's clean
function is the best I can think of...
Thanks again and best wishes, Jack
Attachments (0)
Change History (1)
Changed March 10, 2008 01:39AM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
$('<div>bar</div>') will return a jQuery object containing the element. There's no need to call clean directly.