I am trying to access iframe dom elements from rails 3 partial but its not as expected.
I am trying to access the iframe like this
$j("#batch_grid_frame").contents().find('#ship_box_id').html("HTML")
When i access the page from application it does not update the DOM. But when i run the same below code in browser console this works.
$j("#batch_grid_frame").contents().find('#ship_box_id').html("HTML")
After i googled and tried various things, this is working but is there some way in Jquery i can get this to work
var iframe = window.parent.document.getElementById('batch_grid_frame');
var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
innerDoc.getElementById("shipyu_ox_id").innerHTML = "<%= escape_javascript(render :partial => 'elements/box_select', :locals => {:ywo_types => @ywo_types}) %>";
Any help will be appreciated. Thanks.