jQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery Introduction Example</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<h1 id="heading">Hello, jQuery!</h1>
<button id="changeText">Change Text</button>
<script>
// jQuery code
$(document).ready(function() {
// Select the element with id "heading" and change its text
$('#changeText').click(function() {
$('#heading').text('New Text');
});
});
</script>
</body>
</html>
Code Output
Hello, jQuery!
jQuery
jQuery is a fast and concise JavaScript library that simplifies HTML document traversal, event handling, and animation. It provides a powerful set of features and functions to manipulate the HTML elements on a web page.
To run jQuery, you need to include the jQuery library file in your HTML document.
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>