Guest User

Untitled

a guest
Oct 17th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1.  
  2. Changing Content of HTML through jQuery
  3.  
  4. <html>
  5. <head>
  6. <script type="text/javascript" src="jquery.js"></script>
  7. <script type="text/javascript">
  8. $(document).ready(function(){
  9. $("button").click(function(){
  10. $("p").html("Change the content with jQuery");
  11. });
  12. });
  13. </script>
  14. </head>
  15. <body>
  16. <p>This is a paragraph.</p>
  17. <button>Click me</button>
  18. </body>
  19. </html>
  20.  
  21.  
  22. Append content to HTML through jQuery
  23.  
  24. <html>
  25. <head>
  26. <script type="text/javascript" src="jquery.js"></script>
  27. <script type="text/javascript">
  28. $(document).ready(function(){
  29. $("button").click(function(){
  30. $("p").append(" <b>Content appended through jQuery</b>.");
  31. });
  32. });
  33. </script>
  34. </head>
  35. <body>
  36. <p>This is a paragraph.</p>
  37. <button>Click me</button>
  38. </body>
  39. </html>
  40.  
  41. Append Content after HTML through jQuery
  42.  
  43. <html>
  44. <head>
  45. <script type="text/javascript" src="jquery.js"></script>
  46. <script type="text/javascript">
  47. $(document).ready(function(){
  48. $("button").click(function(){
  49. $("p").after(" New Paragraph added after HTML");
  50. });
  51. });
  52. </script>
  53. </head>
  54. <body>
  55. <p>This is a paragraph.</p>
  56. <button>Click me</button>
  57. </body>
  58. </html>
Add Comment
Please, Sign In to add comment