jQuery - More Targeting Examples

To finding something, a specific tag, you use this: $("{dom element here}}");

The elements that are returned are returned as an array. Once you find something, you can apply functions and styles and just about anything else. $("h2").css("padding-bottom": "10px");

You can also chain methods like this: $("h2").css("padding-bottom" ; "10px").fadeout(5000);

Universal Selector: $("*").css("font-weight" : "bold");

The ID Selector: $(“#txtFirstName”).addClass(“someNewCSSClass”);

The Element Selector: $(“h2”).css(“padding-bottom” : “10px”);

The Class Selector: $(“.my-class”).css(“padding-bottom” : “10px”);

Grouping. You can also group several together like so: $(“h2”,”h3””;h4”).css(“padding-bottom” : “10px”);

Combined Selectors. You can use a combined selector to find something within a specific ID, like so: $(“#HeaderSection p”).css(“padding-bottom”, “10px”);. This would only affect paragraphs within the Header Section.