Regarding the second parameter of the jQuery() method, there are the following usages:
1.jQuery(selector, [context])
This usage is equivalent to $(context).find(selector) or context.find(selector)
2.jQuery(html, [ownerDocument])
The document’s explanation of ownerDocument is: “Create the document where the DOM element is located”
In other words, if you want to write scripts for document, such as iframe or open a new window using window.open, you may need it
3.jQuery(html, props)
This should be more commonly used, just paste the code directly:
$("<input>", { type: "text", val: "Test", focusin: function() { $(this).addClass("active"); }, focusout: function() { $(this).removeClass("active"); } }).appendTo("form")
That is to say, the attributes in props will be set to the newly created tag like the .attr() method
The above is the entire content of this article, I hope you all like it.