Advertisement
kiril_dishliev

Jquery - Append

Nov 18th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.89 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head runat="server">
  5.     <title></title>
  6.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  7.  
  8.     <script>
  9.         $(document).ready(function () {
  10.             $("#btn1").click(function () {
  11.                 $("p").append(" <b>Appended text</b>.");
  12.             });
  13.  
  14.             $("#btn2").click(function () {
  15.                 $("ol").append("<li>Appended item</li>");
  16.             });
  17.         });
  18.     </script>
  19. </head>
  20. <body>
  21.  
  22.     <div>
  23.         <p>This is a paragraph.</p>
  24.         <p>This is another paragraph.</p>
  25.  
  26.         <ol>
  27.             <li>List item 1</li>
  28.             <li>List item 2</li>
  29.             <li>List item 3</li>
  30.         </ol>
  31.  
  32.         <button id="btn1">Append text</button>
  33.         <button id="btn2">Append list items</button>
  34.     </div>
  35.  
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement