Wednesday, April 4, 2012

Access IFrame content

0
this will help you if you want  to access iframe content inside it from main[parent] page.

In Parent file, for example iFrame is declared as below.

<iframe id="id of iframe" scrolling="no" frameborder="0" hidefocus="true" style="text-align: center;vertical-align: top; border-style: none; margin: 0px; width: 100%; height: 60px;" src="page.htm"></iframe>

In page.htm, assume there is a hidden control as shown below.

<input type="hidden" id="field id" name="field  name" />

So, below are the code which help you to asign the value inside ifrmae  hidden field.

var $frmaeid = $('#id of iframe');
$frmaeid.contents().find("body #field id").val("Value asign to hidden field.");

No comments :

Post a Comment