Reputation: 1404
I want to target a text field inside an iFrame and give it a value from prent page. I have tried this one but its not working:
// b_frame is the ID of the iFrame
$('#b_frame').load(function() {<br />
$(this.contentDocument).find('body#txtUserID').val('dddddd')<br />
});
I would really appreciate any help.
Upvotes: 0
Views: 1068
Reputation: 101614
As Felix mentioned, it's only possible when the iFrame is the same domain as the main page.
But, you can do so under normal circumstances using .contents()
. There is a demo towards the bottom of the documentation page, just follow the link.
Upvotes: 2