Reputation: 5
Located outside the iframe, input into, what value is sent.
iframe outside
<input id="a_input_id" type="text">
iframe within
<a href="javascript:;" class="special_field_link">@r.SpecialField<a>
Javascript Code;(iframe in working)
<script>
$(function(){
$(".special_field_link").click(function(){
$("#a_input_id").val($(this).text());
});
});
</script>
https://i.sstatic.net/nnjWH.jpg
Upvotes: 0
Views: 952
Reputation: 207501
As long as the iframe and the parent are in the same domain, you need to use the parent document context
$("#a_input_id", parent.document).val($(this).text());
Upvotes: 1