views:

69

answers:

1

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").dialog({
    bgiframe: true, height: 140, modal: true, autoOpen: false
});

$("#data").html = "My new text"; /*THIS DOES NOT WORK*/
$("#dialog").dialog('open');

Thanks.

+2  A: 

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.

jitter
+1 for answer, boy I couldn't see the trees through the fog! I am such a gimp! Many thanks
Rippo