Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--method text-->
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Latihan jQuery</title>
- <script src="jquery.min.js"></script>
- <script>
- $(document).ready(function() {
- $("#tombol").click(function() {
- var nilai = $("#paragraf").text();
- alert(nilai);
- })
- });
- </script>
- </head>
- <body>
- <p id="paragraf">
- Sedang Belajar <em>jQuery</em> di<b>Matakuliah Desain Web...</b>
- </p>
- <button id="tombol">Ambil Nilai</button>
- </body>
- </html>
- <!--method html-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Latihan jQuery</title>
- <script src="jquery.min.js"></script>
- <script>
- $(document).ready(function() {
- $("#tombol").click(function() {
- var nilai = $("#paragraf").html();
- alert(nilai);
- })
- });
- </script>
- </head>
- <body>
- <p id="paragraf">
- Sedang Belajar <em>jQuery</em> di<b>Matakuliah Desain Web...</b>
- </p>
- <button id="tombol">Ambil Nilai</button>
- </body>
- </html>
- <!--method val-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Latihan jQuery</title>
- <script src="jquery.min.js"></script>
- <script>
- $(document).ready(function() {
- $("#tombol").click(function() {
- var nilai = $("#paragraf").val();
- alert(nilai);
- })
- });
- </script>
- </head>
- <body>
- Nama : <input type="text" id="nama" value="Desain Web...">
- <button id="tombol">Ambil Matakuliah</button>
- </body>
- </html>
- <!--method select-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Latihan jQuery</title>
- <script src="jquery.min.js"></script>
- <script>
- $(document).ready(function() {
- $("#tombol").click(function() {
- var nilai = $("#kota").val();
- alert(nilai);
- })
- });
- </script>
- </head>
- <body>
- Pilih Kota :
- <select id="Kota" name="kota">
- <option value="jakarta">Jakarta</option>
- <option value="bandung">Bandung</option>
- <option value="bogor">Bogor</option>
- </select>
- <button id="tombol">Ambil Nilai</button>
- </body>
- </html>
- <!--method checkbox-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Latihan jQuery</title>
- <script src="jquery.min.js"></script>
- <script>
- $(document).ready(function() {
- xsz
- $("#tombol").click(function() {
- var nilai1 = $("#bandeng:checked").val();
- var nilai2 = $("#cakalang:checked").val();
- var nilai3 = $("#tuna:checked").val();
- alert(nilai1+' '+nilai2+' '+nilai3);
- })
- });
- </script>
- </head>
- <body>
- Pilih Ikan :
- <input type="checkbox" id="bandeng" value="bandeng">Ikan Bandeng
- <input type="checkbox" id="cakalang" value="cakalang">Ikan Cakalang
- <input type="checkbox" id="tuna" value="tuna">Ikan Tuna
- <br><br>
- <button id="tombol">Ambil Nilai</button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement