Book Image

Beginning jQuery

By : Frahaan Hussain
Book Image

Beginning jQuery

By: Frahaan Hussain

Overview of this book

Simple syntax and open coding standards enable developers to deploy applications in a short time. With this course, you will be able to effectively leverage all new features of jQuery 3.0 in your applications. The course begins with teaching the difference between JavaScript and jQuery. You’ll learn how to use jQuery with developer tools that are available in all modern browsers. You’ll then learn all about selecting elements, handling events, manipulating the document object model, jQuery plugins, advanced Ajax, and several advanced concepts. By the end of the course, you will successfully create a fully featured and efficient single page web application.
Table of Contents (10 chapters)
Chapter 8
Advanced Selectors, Traversing, and DOM Manipulation
Content Locked
Section 8
Revisiting Attribute Manipulation
We often create new elements in our jQuery code by providing an HTML string to the $() function or the other DOM insertion functions. This technique is fast and concise. There are circumstances when it is not ideal though. We might, for instance, want to escape special characters from text before it is used, or apply style rules that are browser-dependent. In these cases, we can create the element and then chain on additional jQuery methods to alter it, as we have done many times already. In addition to this standard technique, the $() function itself provides an alternative syntax to achieve the same result. Let’s look at this in more detail.