Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <html>
  2. <object id="t" data="/html_template" type="text/html">
  3. </object>
  4. </html>
  5.  
  6. var t=document.querySelector("#t");
  7. var htmlDocument= t.contentDocument;
  8.  
  9. <html>
  10. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  11. <script type="text/javascript">
  12. $(document).ready(function(){
  13. var k = $("object")[0].innerHTML;
  14. alert(k);
  15. $("object")[0].innerHTML = "testing";
  16. });
  17. </script>
  18. <object data="/html_template">hi</object>
  19. </html>
  20.  
  21. // wait until object loads
  22. $('object').load(function() {
  23. // find the element needed
  24. page = $('object').contents().find('div');
  25. // alert to check
  26. alert(page.html());
  27. });
  28.  
  29. <html>
  30. <div class="main">
  31. <object data="/html_template">
  32. </object>
  33. </div>
  34. </html>
  35.  
  36. $('.main object').load(function() {
  37. var obj = $('.main object')[0].contentDocument.children;
  38. console.log(obj);
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement