cycling jQuery_Succinctly | Page 16

The concept, behind the concept, behind jQuery While selecting something and doing something is the core concept behind jQuery, I would like to extend this concept to include creating something as well. Therefore, the concept behind jQuery could be extended to include first creating something new, selecting it, and then doing something with it. We could call this the concept, behind the concept, behind jQuery. What I am trying to make obvious is that you are not stuck with only selecting something that is already in the DOM. It is additionally important to grok that jQuery can be used to create new DOM elements and then do something with these elements. In the code example below, we create a new element that is not in the DOM. Once created, it is selected and then manipulated. Sample: sample2.html The key concept to pick up here is that we are creating the element on the fly and then operating on it as if it was already in the DOM. jQuery requires HTML to run in standards mode or almost-standards mode There are known issues with jQuery methods not working correctly when a browser renders an HTML page in quirks mode. Make sure when you are using jQuery that the browser interprets the HTML in standards mode or almost standards mode by using a valid doctype. To ensure proper functionality, code examples in this book use the HTML 5 doctype. 16