Apply Button() to an element inside a variable

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2010-05-14T00:12:02Z Indexed on 2010/05/14 0:14 UTC
Read the original article Hit count: 507

Filed under:
|
|
|

If have a variable data = '<div>... <button id="remember"> ... </button> ...</div>', is it possible to apply the .button(); method to a button inside that variable?

I've tried the following:

$('#remember', data).button();

but that doesn't work. After that i just do $(data).dialog();, which works.

I've come with a workaround and that's to append the variable data to the document, call the .button() and then call the .dialog(), but appending and removing dialog's divs on the document doesn't seems right.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui