javascript

jQuery Step By Step Tutorial for Beginners

jQuery Step By Step Tutorial for Beginners

Howdy Coders,

In this post, we will learn some basic usage of jQuery in web development.In modern development, jQuery has become an essential thing.It makes our developing work faster and it is also easy to learn.So Let’s Start.

Pre-Requisites:

-To Learn Jquery Required to have some basic knowledge of HTML and Javascript.

What Is Jquery?

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.

Benefits of using jQuery:

-Jquery makes your Javascript code smaller, faster, and cross-browser support.

-Using jquery you can Handle events like Click, hover, change,keyup, etc… and perform some action on it.

-Jquery allows you to make add animation to your page like fade in, fade out, slide in, slide out or you can make custom animation.

-With Jquery you can also make Ajax request without refreshing your whole page.

-And lot more…..

In This example, we are going to some basic of Javascript Click event by making A button Enable/Disable by using Link.So Let’s begin:

Step-1:

Create an HTML page with its basic structure as follow:

<!DOCTYPE html>
<html>
<head>
<title>jQuery Step-by-step</title>
</head>
<body>
<!-- Content Area-->
</body>
</html>

Step-2:

Add the element to perform some action on it.we’re going to add two links for enabling and disabling and one button.Add the following code inside the Body tag:

<a href="#" id="next">Disable</a>
<button>Register</button>
<a href="#" id="prev">Enable</a>

Step-3:

Now we are going to add Jquery Libray.You can add Jquery by Downloading From official site Jquery.com.But in This example we are going to use Google’s copy of Jquery.Add The Following Code Below the Body tag:

<script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js”></script>

Step-4:

Add jquery Script Below it.In Folwing code we are using link id ‘next’ and ‘prev’ to perform task.

<script type="text/javascript">
$("#next").click(function(){
    $(this).next().attr('disabled',true);
});

$("#prev").click(function(){
    $(this).prev().removeAttr('disabled');
});
</script>

Complete Code: Here is the Complete code achieve from the above steps.

<html>
<head></head>
<body>
<a href="#" id="next">Disable</a>
<button>Register</button>
<a href="#" id="prev">Enable</a>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$("#next").click(function(){
    $(this).next().attr('disabled',true);
});

$("#prev").click(function(){
    $(this).prev().removeAttr('disabled');
});
</script>
</body>
</html>

Conclusion:

So, These are some basic uses of Jquery. Thanks for reading.

Do let me know If you face any difficulties please feel free to comment below we love to help you. if you have any feedback suggestions then please inform us by commenting.

Don’t forget to share this tutorial with your friends on Facebook, and Twitter

If You Appreciate What We Do Here On TutsCoder, You Should Consider:

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Leave a Comment