jQuery is one of the JavaScript frameworks that allows you to use pre-built capabilities and make file navigation easier; In fact, jQuery is a JavaScript library that can be used to create Ajax-based software, low-level exchange programs (browser-to-user communication), and even animated gestures with advanced effects. With the help of jQuery, powerful and dynamic web pages can be designed. Given that jQuery provides some text shortcuts, it can not be considered a substitute for JavaScript; Because the main language of this web design programming language is JavaScript.
Table of Contents
How does JQuery work?
JQuery does not interfere with HTML code and is considered Unobtrusive; This means that none of the JavaScript code fits into the XHTML code, so the website code will be completely separate and tidy. On the other hand, when JS is enabled on the browser, JavaScript code is executed, but if JS is not enabled, there will be no problem in displaying the site. Other jQuery innovations include the selection of tags based on CSS rules, which makes the project easier to execute. Each browser also interprets JS code differently; JQuery provides an environment that assures the web developer that the written code will work properly in all browsers and IE version 6 and later.
Why JQuery?
There are many libraries or frameworks for the JavaScript language, but jQuery seems to be the most popular and extensive library of this language.
Many large web companies around the world use jQuery. As:
- Microsoft
- IBM
- Netflix
But why do they use this awesome language?
- Very simple and understandable instructions for using Ajax technology
- There are numerous and very useful plugins
- Ability to easily change the appearance of a page and support a variety of browsers
- Control and prevent unexpected events when the user clicks
- Add animation to a page
- Get information from a server without having to refresh that page
- Simplify common / duplicate JavaScript operations
- Ease of identifying and changing the coordinates of web pages
What do I need to know before learning jquery?
Before you start learning jQuery, you need to have a basic knowledge of web design. Namely languages:
- HTML
- CSS
- JavaScript
Hide and show methods in jQuery
In jQuery, you can hide and reveal HTML elements using the hide() and show() methods.
$(“#hide”).click(function(){
$(“p”).hide();
});$(“#show”).click(function(){
$(“p”).show();
});
The above code says that when an element with the attribute id =”hide” is clicked, all the p elements on the page will be hidden. And when an element with the attribute id =”show” is clicked, all the p elements on the page will be revealed.