Wait, do I hear someone asking “What is jQuery?”
Table of Contents
- 1 Tip 1 – Enroll In A Decent Online Course
- 3 Tip 3 – Learn How To Use The jQuery Cheatsheet
- 4 Tip 4 – Make Sure You Understand The Difference Between ID & Class In HTML
- 5 Tip 5 – Learn How To Cache Selectors
- 6 Tip 6 – Learn To Differentiate Between ‘Attributes’ & ‘Properties’
- 7 Tip 7 – Don’t Be Afraid To Ask For Help
- 8 Tip 8 – Make Sure You’re Using The Latest Version Of jQuery
- 9 Tip 9 – Learn jQuery Plugins
- 10 Tip 10 – Network With Other jQuery Users
- 11 Conclusion
Tip 1 – Enroll In A Decent Online Course
When you’re learning how to use jQuery – or any other programming language or concept – then arguably the most important thing to do is enroll yourself in a decent online course. I’m a big fan of online courses for many reasons. They’re easy to use, and they allow you to work through things at your own pace at times that suit you. They also allow you to return to and revise difficult concepts as many times as you want to.
I’ve looked at a few different jQuery tutorials and courses, but I can honestly recommend the Interactive jQuery Tutorial. As far as jQuery courses go, this course provides the best, most comprehensive overview of jQuery and how it’s used that I’ve come across. It gives clear instructions, it is relatively simple to use, and it will teach you how to create the perfect dynamic website with a minimal amount of work using jQuery.
Tip 3 – Learn How To Use The jQuery Cheatsheet
If you’re serious about learning how to use jQuery properly, then it’s important to get familiar with a range of other resources. The jQuery Cheat Sheet is a great resource that you can use to make sure that you’re getting the most out of your course. Despite what you may have been told in the past, you don’t have to learn everything about something like jQuery to be able to use it. Rather, I would argue that the most important thing is that you are familiar with resources – like the jQuery Cheat Sheet – that you can refer to when you come across concepts or ideas that you don’t understand.
In my opinion, the best way to learn jQuery is to use this cheat sheet alongside an online course – like those discussed above – to make sure that you understand everything in the course. You don’t have to be able to remember everything that you’re taught, but you need to learn enough to be able to go to your cheat sheet and understand something when you look it up.
Tip 4 – Make Sure You Understand The Difference Between ID & Class In HTML
Since jQuery can be used to modify your HTML source code directly, it is important for you to understand a little bit about HTML and how you interact with it. There are two main attributes of your HTML markup that you can change with jQuery – ID attributes and class attributes. These are very different things, and they must be treated as such when you’re using jQuery.
Let’s deal with ID attributes first. When you write HTML, you might decide to add an ID attribute to important elements. ID attributes are unique, and they can only be used for one element per page. The jQuery syntax for addressing an element with a particular ID is $(‘#elementID’). Make sure that you note the ‘#’ prefix that is used for selecting by ID.
HTML class attributes are slightly different. They are much less selective and much more widely used than ID attributes. Class attributes can be assigned to any element on a page – including those with an ID. They can be assigned to as many or as few elements as you need them to be, which makes them useful for grouping similar elements together. The jQuery syntax for addressing an element by class is (‘.elementClass’). Note the ‘.’ a prefix that is used for selecting by class.
If your HTML and CSS skills are slightly rusty, it could be a good idea to work on them a bit while you’re learning jQuery. Have a look at the Interactive Coding for Beginners course to go over the basics of HTML, CSS, and web development for beginners.
Tip 5 – Learn How To Cache Selectors
Although this might not make much sense to you until you’ve started to learn jQuery, it’s essential for you to learn how to cache your selectors efficiently. Caching your selectors means storing them as a variable that you can come back to over and over again. This means that jQuery doesn’t have to look up information every time you use this selector to call on particular objects, making your programs run faster.
When you’re choosing a variable name for your cached selector, make sure that you use some sort of prefixes to label the variable as a jQuery object. Since most jQuery selectors are prefixed with ‘$’, I like to use the same syntax when I’m naming variables that contain jQuery objects. As such, a line of code storing a selector to a variable might look like this:
“var $selectorvariable = $(‘selectedElements’);”
As you can see, this marks your ‘selector variable’ as a jQuery object, making your code clearer and easier to follow.
If you would like to learn more about jQuery selectors and how they are used, then head to the jQuery Tutorials selector page here.
Tip 6 – Learn To Differentiate Between ‘Attributes’ & ‘Properties’
Back to HTML quickly. Although you may not consciously be aware of it, HTML attributes and properties are two completely different things. It is super important for us to be able to differentiate between the two because the jQuery methods differ depending on which one you’re trying to handle.
Attributes can only have string values, and these values are determined by the HTML source code. The jQuery syntax for handling attributes is attr(). Properties are different. They are defined by the DOM model, and they can have values of any type. Properties can be handled using the prop() method.
Anything that only accepts a string value can be modified using the attr() method, while everything that accepts other types of value – including numbers or Booleans – needs to be modified using the prop() method.
If you want to learn more about these and other methods and how they are used, head over to the learn jQuery Syntax page. Here you can look at prop(), attr(), and a range of other methods in more detail.
Tip 7 – Don’t Be Afraid To Ask For Help
My favorite place to get help with problems when I’m coding is online forums. Forums are places where people who are interested in talking about coding and coding problems meet online to interact. Posting questions about jQuery on a relevant forum will almost definitely lead to you gathering information and answers to your questions. Two of my favorite forums for jQuery problems are the official jQuery forum and the Stack Overflow jQuery forum.
Tip 8 – Make Sure You’re Using The Latest Version Of jQuery
As a constantly developing library with an active team of developers, jQuery is changing all the time. If you want to make sure that you’re getting the most out of your jQuery experience, make sure that you’re learning how to use jQuery with the most recent version.
At the time of writing, the most recent jQuery version is jQuery 3.0. This features a range of updates from previous versions, so it’s very important to make sure that you’re using this version. If you’re in doubt, head over to the official jQuery 3.0 Upgrade Guide and have a look at what changes have been made.
Tip 9 – Learn jQuery Plugins
Plugins are wonderful things. Whether you’re using WordPress, Shopify, jQuery, or some other program that lets you create things, plugins are likely going to become one of your best friends. If you plan on using jQuery regularly, then you need to discover some plugins. The best places to search for and learn jQuery plugins are via the jQuery UI library and the jQuery plugin registry (surprise surprise!), where you can find pretty much everything you can think of.
jQuery plugins can do a whole range of different things. Some have been designed to solve issues that may come up when you start using jQuery on your websites, while others are used to perform specific functions or to make specific tasks easier. The best thing for you to do now is to head over to one of the libraries mentioned above and look around to find out more.
Tip 10 – Network With Other jQuery Users
Now, a major part of learning how to use a programming language, tool, library, or anything else is networking with other interested learners. You can connect with other people who are trying to learn jQuery via some of the forums discussed above (the official jQuery forum and the Stack Overflow forum), but I prefer to meet people in person.
Alternatively, have a look at Meetup. I’ve found groups on here with great success, no matter where I am in the world. Although there aren’t any specific jQuery groups where I am now (Perth, Australia), there is a large front-end web developer group that meets regularly. I know for a fact that a lot of these people are fluent in or learning jQuery, and I’ve made quite good friends with a few of the group members.
You need to learn jQuery of course!
Above all, take things slowly and make sure that you take notes and do more research when you come across difficult concepts. Have fun learning and using jQuery – I know I did!