Guest User

Untitled

a guest
Dec 18th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.22 KB | None | 0 0
  1.     <script src="https://code.jquery.com/jquery-1.12.4.min.js">
  2.   </script>
  3.     <style type="text/css">
  4.         textarea,
  5.         iframe {
  6.             display: block;
  7.             margin: 10px 0;
  8.         }
  9.          
  10.         iframe {
  11.             width: 500px;
  12.             height: 500px;
  13.             border: 1px solid #000000;
  14.         }
  15.     </style>  
  16.  
  17.     <center>
  18.         <h1 style="color:green;">  
  19.         GeeksForGeeks  
  20.     </h1>
  21.         <h3>
  22.           How to insert HTML content into an iFrame using jQuery
  23.       </h3>
  24.         <textarea rows="2" cols="40" style="text-align:center;">
  25.           This text will appear into the input of iframe
  26.       </textarea>
  27.         <button type="button" onclick="updateIframe()">
  28.           Click to Insert
  29.       </button>
  30.         <iframe src="http://www.e-chat.co/room/create" style="text-align:center;" id="myframe"></iframe>
  31.         <script type="text/javascript">
  32.             function updateIframe() {
  33.                 var myFrame = $("#myframe").contents().find('#CreateChatroomInputName');
  34.                 var textareaValue = $("textarea").val();
  35.                 myFrame.html(textareaValue);
  36.             }
  37.         </script>
  38.     </center>
Add Comment
Please, Sign In to add comment