Before we move on to discussing how to install jQuery and other advanced topics, let us talk about some basics of jQuery, such as, what is jQuery?
What is jQuery?
Selecting an HTML element with the class name “heading”.
jQuery selector engine
In jQuery, we can select HTML elements as we select in CSS. For example, we can add dot ‘.’ before the class name to select an element by its class name.
In the same way, in jQuery, we can select an element as simple as
Another advantage of jQuery is its chainable methods. You can chain methods together to perform multiple actions in one line of code. Each time you run a jQuery function, it returns a jQuery object which then can accept another method to apply. So you can run multiple methods in one line by separating each one of them by a “.” dot.
For example, to add a class to a heading and CSS in the same line, we’d chain the two methods ‘addClass’ and ‘css’ together.
- $(“h2”) – This will select the heading in the document.
- addClass – This method will add “animated” class to h2.
- css – This method will apply css to h2.
jQuery UI is the jQuery extension for developing the application interface. It comes with a range of pre-designed elements or widgets to add to your application. The widgets include Datepicker, Autocomplete, Buttons, Menus, Progress bars, spinners, and many more. Check out jQuery UI for more information.
jQuery UI is not included in the jQuery core library but can be added separately.
Due to its easy-to-use syntax, it’d not take much to learn jQuery. jQuery’s powerful selector engine helps developing applications faster. In the next article, we will set up a jQuery development environment to improve the development process.