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?





Rating:
The post javascript – How to select element based on another already-existing selector? appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/javascript-how-to-select-element-based-on-another-already-existing-selector.html
No comments:
Post a Comment