Are you interested in JavaScript? But do not want to write complex code in JavaScript. Well! In that case JQuery could be a solution.
JQuery is a light weight JavaScript library that is present in a single JavaScript file.
And as mentioned above, JQuery takes a lot of common task from JavaScript that needs tons of lines of code to accomplish and provides methods for those.
Let us write our first JQuery Application which just prints Hello World on the screen.
<html>
<body>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"> </script>
<script>
$(document).ready(function () {
document.write("Hello World")
});
</script>
</body>
</html>
document.write("Hello World")<html> <body> .... .... </body> </html>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"> </script>
<script>
$(document).ready(function () {
document.write("Hello World")
});
</script><script>
$(document).ready(
function () {
document.write("Hello World")
}
);
</script>$(document).ready(...);
function () {
document.write("Hello World")
}document.write("Hello World")We have to write all our codes inside the $(document).ready(function () {}); method. And the $(document).ready() method should be inside <html>, <body> and <script> tags.
<html>
<body>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"> </script>
<script>
$(document).ready(function () {
//OUR CODE SHOULD BE WRITTEN HERE.
});
</script>
</body>
</html>