May 2017
Intermediate to advanced
448 pages
10h 10m
English
We often create new elements in our jQuery code by providing an HTML string to the $() function or to DOM insertion functions. For example, we create a large HTML fragment in Listing 12.9 in order to produce many DOM elements. This technique is fast and concise. There are circumstances when it is not ideal. 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.
Suppose ...
Read now
Unlock full access