jQuery: Using The Basic Selectors

Welcome back to another post, in the previous post we talked about the basic selectors, in this post we will be using them.

We will start with the element selector:

$(document).ready(function() {
$("p").hide();
});

In here we selected all the “p” elements and hid them, there are other built-in functions that we will be discussing in the future posts.

The second basic selector, is the “#id” selector, which is the following:

$(document).ready(function() {
$("#headerOne").hide();
});

So this selects the element with the id of “headerOne” and hides it. The third basic selector is the “.class” selector:

$(document).ready(function() {
$(".navigationClass").hide();
});

Selects any element with the class: navigationClass. And finally, the “*” selector, selects all the elements:

$(document).ready(function() {
$("*").hide();
});

These were the basic selectors, for a full reference on jQuery selectors, visit this link.

I hope you enjoyed this post, make sure to follow me on WordPress and on twitter. If you face any problems or have any questions or have any suggestions, please let me know. Other than that, see you in the next post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s