Tiga metode inti untuk membaca konten DOM: text() untuk teks murni, html() termasuk tag HTML, dan val() untuk elemen formulir.
jQuery Get
Contoh Kode jQuery jQuery Get:
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
</head>
<body style="font-family: sans-serif; padding: 20px;">
<input type="text" id="namaInput" value="Faisal Skillance">
<button id="btnBaca">Baca Nilai Input</button>
<script>
$('#btnBaca').click(function() {
alert("Nilai Input: " + $('#namaInput').val());
});
</script>
</body>
</html>
Uji interaksi jQuery di atas dan amati animasi efek DOM secara langsung.