silmasye

Latihan JQuery_12191706

May 3rd, 2020
665
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!--method text-->
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Latihan jQuery</title>
  6. <script src="jquery.min.js"></script>
  7. <script>
  8.     $(document).ready(function() {
  9.    
  10.         $("#tombol").click(function() {
  11.         var nilai = $("#paragraf").text();
  12.         alert(nilai);
  13.         })
  14.        
  15.     });
  16. </script>
  17. </head>
  18. <body>
  19. <p id="paragraf">
  20.     Sedang Belajar <em>jQuery</em> di<b>Matakuliah Desain Web...</b>
  21. </p>
  22. <button id="tombol">Ambil Nilai</button>
  23. </body>
  24. </html>
  25.  
  26. <!--method html-->
  27. <!DOCTYPE html>
  28. <html>
  29. <head>
  30. <meta charset="UTF-8">
  31. <title>Latihan jQuery</title>
  32. <script src="jquery.min.js"></script>
  33. <script>
  34.     $(document).ready(function() {
  35.    
  36.         $("#tombol").click(function() {
  37.         var nilai = $("#paragraf").html();
  38.         alert(nilai);
  39.         })
  40.        
  41.     });
  42. </script>
  43. </head>
  44. <body>
  45. <p id="paragraf">
  46.     Sedang Belajar <em>jQuery</em> di<b>Matakuliah Desain Web...</b>
  47. </p>
  48. <button id="tombol">Ambil Nilai</button>
  49. </body>
  50. </html>
  51.  
  52. <!--method val-->
  53. <!DOCTYPE html>
  54. <html>
  55. <head>
  56. <meta charset="UTF-8">
  57. <title>Latihan jQuery</title>
  58. <script src="jquery.min.js"></script>
  59. <script>
  60.     $(document).ready(function() {
  61.    
  62.         $("#tombol").click(function() {
  63.         var nilai = $("#paragraf").val();
  64.         alert(nilai);
  65.         })
  66.        
  67.     });
  68. </script>
  69. </head>
  70. <body>
  71. Nama : <input type="text" id="nama" value="Desain Web...">
  72. <button id="tombol">Ambil Matakuliah</button>
  73. </body>
  74. </html>
  75.  
  76. <!--method select-->
  77. <!DOCTYPE html>
  78. <html>
  79. <head>
  80. <meta charset="UTF-8">
  81. <title>Latihan jQuery</title>
  82. <script src="jquery.min.js"></script>
  83. <script>
  84.     $(document).ready(function() {
  85.    
  86.         $("#tombol").click(function() {
  87.         var nilai = $("#kota").val();
  88.         alert(nilai);
  89.         })
  90.        
  91.     });
  92. </script>
  93. </head>
  94. <body>
  95. Pilih Kota :
  96. <select id="Kota" name="kota">
  97.     <option value="jakarta">Jakarta</option>
  98.     <option value="bandung">Bandung</option>
  99.     <option value="bogor">Bogor</option>
  100. </select>
  101. <button id="tombol">Ambil Nilai</button>
  102. </body>
  103. </html>
  104.  
  105. <!--method checkbox-->
  106. <!DOCTYPE html>
  107. <html>
  108. <head>
  109. <meta charset="UTF-8">
  110. <title>Latihan jQuery</title>
  111. <script src="jquery.min.js"></script>
  112. <script>
  113.     $(document).ready(function() {
  114.     xsz
  115.         $("#tombol").click(function() {
  116.         var nilai1 = $("#bandeng:checked").val();
  117.         var nilai2 = $("#cakalang:checked").val();
  118.         var nilai3 = $("#tuna:checked").val();
  119.         alert(nilai1+' '+nilai2+' '+nilai3);
  120.         })
  121.        
  122.     });
  123. </script>
  124. </head>
  125. <body>
  126. Pilih Ikan :
  127.     <input type="checkbox" id="bandeng" value="bandeng">Ikan Bandeng
  128.     <input type="checkbox" id="cakalang" value="cakalang">Ikan Cakalang
  129.     <input type="checkbox" id="tuna" value="tuna">Ikan Tuna
  130. <br><br>
  131. <button id="tombol">Ambil Nilai</button>
  132. </body>
  133. </html>
RAW Paste Data