I have the following code:
<html>
<head>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load("jquery", 1);
</script>
<script type="text/javascript">
var rt, rt2;
window.onload = function () {
rt = $('#rt').contents().get(0);
rt.designMode = 'On';
}
</script>
</head>
<body>
<iframe id="rt" width="500" height="500"></iframe>
</body>
</html>
rt is currently selecting the whole iframe document. I want rt2 to select the body element inside the document element, which is what rt is selecting. I tried:
rt2 = jQuery(rt, "html");
rt2 = jQuery(rt2, "body");
But it didn’t seem to work. How would it be possible?
According to the documentation, the context to search within should be supplied as the second parameter, not the first, so try this instead:
The context can be:
Internally, the context is implemented using the
.find()method. So the above example is just a short hand of: