2

For example:

<html><body><object data="" id="something"></object></body></html>

How can i select a tag in this object? Tks ^^

1
  • In title you talk about iframe in the question about the object. Do you mean selecting an element in the iframe from its parent (the html page containing the iframe) ? Commented May 27, 2013 at 9:28

1 Answer 1

2

You need to get the iframe contents first to apply selector on it. You can use jQuery contents() function to get.

var objSomething = $('#iframeID').contents().find('#something');

You should call this script when iframe is loaded. You can use window.load to ensure that.

$(window).load(function(){
   var objSomething = $('#iframeID').contents().find('#something');
   alert(objSomething[0].id);
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.