Here is a comprehensive guide that will help you to understand the basics of jQuery.
We will do out best to cut learning fluff, and update the guide based on your input.
jQuery outputs commands onto the DOM.
jQuery allows for direct DOM manipulation.
Many of the library’s commands are concise and clear.
Enterprise and smaller scale applications use jQuery due to its flexibility.
Tip: jQuery web apps may be fast because jQuery manipulates the DOM directly. In our testing, jQuery apps loaded faster than Angular or React counterparts.
jQuery uses the following syntax:
The ‘$’ symbol summons jQuery to execute.
The ‘selector’ selects a DOM element to manipulate.
The ‘action’ is what manipulates the DOM element.
Using jQuery in the HTML DOM
Below some useful selectors in jQuery
One of the most fun features of jQuery is its use of effects.
Effects allow developers to produce transitory animations on selected DOM elements.
Commonly used jQuery effects are
- hide() = Hides DOM elements from the screen.
- show() = Shows DOM elements on the screen.
- animate() = Allows you to customize animations for your needs.
Tip: Developers can use animate() for most jQuery effects.
jQuery with AJAX GET/POST Requests
Developers can use jQuery for GET and POST requests.
The get() method pulls information from a server to a client.
The post() method pulls information from a server to a client without caching data.
Tip: The post() method is more secure than the get() method because it does not cache data. The post() method is slower than the get() method.
Avanka IT jQuery Tips
- Limit DOM interactions.
- Do not access layout properties unnecessarily.
- Keep selectors simple.
- Turn your code into a jQuery plugin to avoid code conflicts. Doing so limits dependabilities and improve reusability.
- Use local storage instead of cookies.
- Refrain from using anonymous functions in your code.
- Avoid using global variables.
- JQuery Tutorial. (2018). Retrieved September 20, 2018, from https://www.w3schools.com/jquery/
- How jQuery Works. (2018). Retrieved September 20, 2018, from https://learn.jquery.com/about-jquery/how-jquery-works/
- JQuery Basics. (2018). Retrieved September 20, 2018, from https://www.tutorialspoint.com/jquery/jquery-basics.htm
- Jaeger, R. (2017, March 17). JQuery Selectors – The Absolute Basics – Robbie Jaeger – Medium. Retrieved September 20, 2018, from https://firstname.lastname@example.org/jquery-selectors-the-absolute-basics-d781500c722c
Owner of Avanka IT and technology enthusiast. I enjoy thoughtful discussions on the intersection of business, technology, and socially beneficial ventures. Reach out anytime for assistance or friendly discussions.