- HTML/DOM and CSS manipulation
- HTML event methods
- Effects and animations
Today I shall discuss the advantages of JQuery and provide some simple code examples to start you off on your coding journey.
Update the version of jQuery
It’s important to always have the most current version and the most stable release of jQuery. Each release irons out bugs and have a higher performance rate. You can even reference jQuery from Google’s CDN servers
<!-- specific version of jQuery -->
Naming of element names
Try to optimize and keep naming conventions of element names and ID’s simple. This will not only speed server time up with regard to performance time and accessing information from the DOM, but will also be beneficial when maintaining code.
JQuery uses selectors so that we can manipulate HTML elements, so keep element names and ID naming conventions simple as mentioned above. All selector names commence with a dollar sign. The following code below hides a <p> element when the button is clicked:
jQuery animation method
jQuery syntax conventions
jQuery provides its own custom syntax for selecting HTML elements so that actions can be performed on them. Syntax convention is $(selector).action(); Below is some more code syntax examples:
hides all paragraph elements.
hides all elements with class reference “coffee”.
hides the element with id reference “coffee”.