You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>As of jQuery 1.4, the second argument to <code>jQuery()</code> can accept a map consisting of a superset of the properties that can be passed to the <ahref="/attr">.attr()</a> method. Furthermore, any <ahref="/category/events/">event type</a> can be passed in, and the following jQuery methods can be called: <ahref="/val">val</a>, <ahref="/css">css</a>, <ahref="/html">html</a>, <ahref="/text">text</a>, <ahref="/data">data</a>, <ahref="/width">width</a>, <ahref="/height">height</a>, or <ahref="/offset">offset</a>. The name <code>"class"</code> must be quoted in the map since it is a JavaScript reserved word, and <code>"className"</code> cannot be used since it is not the correct attribute name. </p>
171
+
<p>As of jQuery 1.4, the second argument to <code>jQuery()</code> can accept a plain object consisting of a superset of the properties that can be passed to the <ahref="/attr">.attr()</a> method. Furthermore, any <ahref="/category/events/">event type</a> can be passed in, and the following jQuery methods can be called: <ahref="/val">val</a>, <ahref="/css">css</a>, <ahref="/html">html</a>, <ahref="/text">text</a>, <ahref="/data">data</a>, <ahref="/width">width</a>, <ahref="/height">height</a>, or <ahref="/offset">offset</a>.</p>
172
+
<p><strong>As of jQuery 1.8</strong>, any jQuery instance method (a method of <code>jQuery.fn</code>) can be used as a property of the object passed to the second parameter:</p>
173
+
<pre><code>
174
+
$( "<div></div>", {
175
+
append: "<span>hello</span>"
176
+
}).appendTo( "body" );
177
+
</code></pre>
178
+
<p>The name <code>"class"</code> must be quoted in the map since it is a JavaScript reserved word, and <code>"className"</code> cannot be used since it is not the correct attribute name. </p>
172
179
<p><strong>Note:</strong> Internet Explorer will not allow you to create an <code>input</code> or <code>button</code> element and change its type; you must specify the type using <code>'<input type="checkbox" />'</code> for example. A demonstration of this can be seen below:</p>
0 commit comments