Reputation: 41
I would load a html (in file :/retc.html) :
<input id="x" type="text" name="number" value="" size="5" />
to html div on another page:
<div id="property"></div>
I would fill value in the input after load.
I am using this script in onclick function:
$("#property").load("/rect.html");
$('#x').val("5");
Loading of the input is OK, but the value is not filled. The value flashes in input only. Where is the problem?
Thanks very much.
Upvotes: 2
Views: 649
Reputation: 24236
Try using the callback argument of the load
function -
$("#property").load("/rect.html",function() {
$('#x').val("5");
});
That should ensure the text box is available on the page before you try to populate it.
Upvotes: 4