Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




A Taste of jQuery

This article is just to give you a brief of how jQuery can help you with complicated projects that just Vanilla javaScript won’t help you. So if you want to add some visual effects and interactivity to your webpage you should give a shot to javaScript library jQuery.

The jQuery library makes front-end development easier by simplifying things such as AJAX Operations, DOM Manipulation, Event Handling, and much more. If you want to add some visual effects and interactivity to your webpage you should give javaScript library jQuery a try. As a result, you can write fewer lines of code like the example below and accomplish more in a short amount of time.

In the example below, $(document) is used to target HTML document and create a jQuery object representing the page.

When the page is ready, the function inside the parentheses of the .ready() method is run.

Once targeted, we can use . notation to attach a handler method .ready()that triggers a callback function.

In the example below by Codecademy, the jQuery .on()method adds event handlers to jQuery objects. There are two parts to an event handler: an event listener and a callback function

As of jQuery 1.7, the .on() method provides all functionality required for attaching event handlers.

Both the event listener and callback function make up an event handler.

Here are some examples of Mouse Events that you see very often in websites and it can be accomplished with event handler.

Here is another example of event to hide all <p> elements with a “click”.

As you can see, jQuery can greatly simplifies JavaScript programming. So give it a try and have fun in your next project.

Happy coding! See you soon.

Add a comment

Related posts:

10 iPhone Apps For The Month Of May

The month of May is a special one. We are in the middle of the spring where trees look pristine, their greenness radiates the calm nature we have all experienced which comes with a mixture of the…

Mini boar

Mini boar is exhausted, snorting. “Mini boar” is published by Nolam Eaton.