For the second argument about the jquery () method, there are several uses:
1.jQuery (selector, [context])
This usage is equivalent to $ (context). Find (selector) or Context.find (selector)
2.jQuery (HTML, [ownerdocument])
The document's explanation for Ownerdocument is: "Create the document where the DOM element resides"
That is, if you want to write a script that takes document, such as an IFRAME or open a new window with window.open, you might need it
3.jQuery (HTML, props)
This should be more commonly used, directly affixed to the code:
$ ("<input>", {
type: "Text",
val: "Test",
focusin:function () {
$ (this). AddClass ("active");
} ,
focusout:function () {
$ (this). Removeclass ("active");
}
). Appendto ("form")
That is, the properties within the props will be set to the newly created label like the. attr () method.
The above mentioned is the entire content of this article, I hope you can enjoy.