I have the following jQuery dialog and I want to change the contents of a div inside the dialog just before I open it. However I can't seem to fathom it out, can any one help?
<div id="dialog" title="Basic dialog">
<div id="data"></div>
</div>
$("#dialog").dial开发者_StackOverflow中文版og({
bgiframe: true, height: 140, modal: true, autoOpen: false
});
$("#data").html = "My new text"; /*THIS DOES NOT WORK*/
$("#dialog").dialog('open');
Thanks.
Use
$("#data").html("My new text");
not $("#data").html = "My new text";
. There is no property html
on a jQuery object. Instead there is a function html(val)
to set the html content, of every element matched with the selector (in your case #data
.
精彩评论