3

Eg: Fetching text input value using jQuery $('#username').val();

I had tried this from this question

Here is my code

<div id="siteloader"></div>

$(window).load(function(){
    $("#siteloader").html('<object data="http://testk.shopnix.org/admin" />');
    setTimeout(function() {
      console.log($("#lemail_id"));
      $("#lemail_id").val("lemail_id");
      console.log($("#lemail_id").val());
    }, 10000)

})

JS fiddle here

1 Answer 1

6
  1. Use event onload instead of timeout.
  2. For access to object internal structure use method contents()
  3. WARNING: It may doesn't work on jsfiddle. This site block XSS requests for security reasons.


HTML:

<div id="siteloader">
  <object id="object1" data="" />
</div>


JS:

$(function() {
  $("#object1").load(function() {
    $(this).contents().find("#lemail_id").val("lemail_id")
  });
  $("#object1").attr('data', 'http://testk.shopnix.org/admin');
});

js fiddle

2
  • 2
    @KiranReddy I've written about it above, please be carefully Feb 16, 2017 at 10:45
  • Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLObjectElement': Blocked a frame with origin "localhost" from accessing a cross-origin frame. Feb 18, 2017 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.