⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jquery1.1_api_en.xml

📁 jquery api解压后即可使用
💻 XML
📖 第 1 页 / 共 5 页
字号:
// other code using $ as an alias to the other library</code></examples></method><method cat='JavaScript' type='Object' short='A generic iterator function, which can be used to seemlesslyiterate over both objects and arrays.' name='$.each'><desc>A generic iterator function, which can be used to seemlesslyiterate over both objects and arrays. This function is not the sameas $().each() - which is used to iterate, exclusively, over a jQueryobject. This function can be used to iterate over anything.The callback has two arguments:the key (objects) or index (arrays) as firstthe first, and the value as the second.</desc><params type='Object' name='obj'><desc>The object, or array, to iterate over.</desc></params><params type='Function' name='fn'><desc>The function that will be executed on every object.</desc></params><examples><desc>This is an example of iterating over the items in an array,accessing both the current item and its index.</desc><code>$.each( [0,1,2], function(i, n){  alert( "Item #" + i + ": " + n );});</code></examples><examples><desc>This is an example of iterating over the properties in anObject, accessing both the current item and its key.</desc><code>$.each( { name: "John", lang: "JS" }, function(i, n){  alert( "Name: " + i + ", Value: " + n );});</code></examples></method><method cat='JavaScript' type='String' short='Remove the whitespace from the beginning and end of a string.' name='$.trim'><desc>Remove the whitespace from the beginning and end of a string.</desc><params type='String' name='str'><desc>The string to trim.</desc></params><examples><code>$.trim("  hello, how are you?  ");</code><result>"hello, how are you?"</result></examples></method><method cat='JavaScript' type='Array' short='Merge two arrays together, removing all duplicates.' name='$.merge'><desc>Merge two arrays together, removing all duplicates.The new array is: All the results from the first array, followedby the unique results from the second array.</desc><params type='Array' name='first'><desc>The first array to merge.</desc></params><params type='Array' name='second'><desc>The second array to merge.</desc></params><examples><desc>Merges two arrays, removing the duplicate 2</desc><code>$.merge( [0,1,2], [2,3,4] )</code><result>[0,1,2,3,4]</result></examples><examples><desc>Merges two arrays, removing the duplicates 3 and 2</desc><code>$.merge( [3,2,1], [4,3,2] )</code><result>[3,2,1,4]</result></examples></method><method cat='JavaScript' type='Array' short='Filter items out of an array, by using a filter function.' name='$.grep'><desc>Filter items out of an array, by using a filter function.The specified function will be passed two arguments: Thecurrent array item and the index of the item in the array. Thefunction must return 'true' to keep the item in the array, false to remove it.</desc><params type='Array' name='array'><desc>The Array to find items in.</desc></params><params type='Function' name='fn'><desc>The function to process each item against.</desc></params><params type='Boolean' name='inv'><desc>Invert the selection - select the opposite of the function.</desc></params><examples><code>$.grep( [0,1,2], function(i){  return i &gt; 0;});</code><result>[1, 2]</result></examples></method><method cat='JavaScript' type='Array' short='Translate all items in an array to another array of items.' name='$.map'><desc>Translate all items in an array to another array of items.The translation function that is provided to this method is called for each item in the array and is passed one argument: The item to be translated.The function can then return the translated value, 'null'(to remove the item), or  an array of values - which willbe flattened into the full array.</desc><params type='Array' name='array'><desc>The Array to translate.</desc></params><params type='Function' name='fn'><desc>The function to process each item against.</desc></params><examples><desc>Maps the original array to a new one and adds 4 to each value.</desc><code>$.map( [0,1,2], function(i){  return i + 4;});</code><result>[4, 5, 6]</result></examples><examples><desc>Maps the original array to a new one and adds 1 to eachvalue if it is bigger then zero, otherwise it's removed-</desc><code>$.map( [0,1,2], function(i){  return i &gt; 0 ? i + 1 : null;});</code><result>[2, 3]</result></examples><examples><desc>Maps the original array to a new one, each element is addedwith it's original value and the value plus one.</desc><code>$.map( [0,1,2], function(i){  return [ i, i + 1 ];});</code><result>[0, 1, 1, 2, 2, 3]</result></examples></method><method property='1' cat='JavaScript' type='Boolean' short='Contains flags for the useragent, read from navigator.' name='$.browser'><desc>Contains flags for the useragent, read from navigator.userAgent.Available flags are: safari, opera, msie, mozillaThis property is available before the DOM is ready, therefore you canuse it to add ready events only for certain browsers.There are situations where object detections is not reliable enough, in thatcases it makes sense to use browser detection. Simply try to avoid both!A combination of browser and object detection yields quite reliable results.</desc><examples><desc>Returns true if the current useragent is some version of microsoft's internet explorer</desc><code>$.browser.msie</code></examples><examples><desc>Alerts "this is safari!" only for safari browsers</desc><code>if($.browser.safari) { $( function() { alert("this is safari!"); } ); }</code></examples></method><method cat='DOM/Traversing' type='jQuery' short='Get a set of elements containing the unique parents of the matchedset of elements.' name='parent'><desc>Get a set of elements containing the unique parents of the matchedset of elements.Can be filtered with an optional expressions.</desc><params type='String' name='expr'><desc>(optional) An expression to filter the parents with</desc></params><examples><desc>Find the parent element of each paragraph.</desc><before>&lt;div&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;/div&gt;</before><code>$("p").parent()</code><result>[ &lt;div&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;/div&gt; ]</result></examples><examples><desc>Find the parent element of each paragraph with a class "selected".</desc><before>&lt;div&gt;&lt;p&gt;Hello&lt;/p&gt;&lt;/div&gt;&lt;div class="selected"&gt;&lt;p&gt;Hello Again&lt;/p&gt;&lt;/div&gt;</before><code>$("p").parent(".selected")</code><result>[ &lt;div class="selected"&gt;&lt;p&gt;Hello Again&lt;/p&gt;&lt;/div&gt; ]</result></examples></method><method cat='DOM/Traversing' type='jQuery' short='Get a set of elements containing the unique ancestors of the matchedset of elements (except for the root element).' name='parents'><desc>Get a set of elements containing the unique ancestors of the matchedset of elements (except for the root element).Can be filtered with an optional expressions.</desc><params type='String' name='expr'><desc>(optional) An expression to filter the ancestors with</desc></params><examples><desc>Find all parent elements of each span.</desc><before>&lt;html&gt;&lt;body&gt;&lt;div&gt;&lt;p&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/p&gt;&lt;span&gt;Hello Again&lt;/span&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;</before><code>$("span").parents()</code><result>[ &lt;body&gt;...&lt;/body&gt;, &lt;div&gt;...&lt;/div&gt;, &lt;p&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/p&gt; ]</result></examples><examples><desc>Find all parent elements of each span that is a paragraph.</desc><before>&lt;html&gt;&lt;body&gt;&lt;div&gt;&lt;p&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/p&gt;&lt;span&gt;Hello Again&lt;/span&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;</before><code>$("span").parents("p")</code><result>[ &lt;p&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/p&gt; ]</result></examples></method><method cat='DOM/Traversing' type='jQuery' short='Get a set of elements containing the unique next siblings of each of thematched set of elements.' name='next'><desc>Get a set of elements containing the unique next siblings of each of thematched set of elements.It only returns the very next sibling, not all next siblings.Can be filtered with an optional expressions.</desc><params type='String' name='expr'><desc>(optional) An expression to filter the next Elements with</desc></params><examples><desc>Find the very next sibling of each paragraph.</desc><before>&lt;p&gt;Hello&lt;/p&gt;&lt;p&gt;Hello Again&lt;/p&gt;&lt;div&gt;&lt;span&gt;And Again&lt;/span&gt;&lt;/div&gt;</before><code>$("p").next()</code><result>[ &lt;p&gt;Hello Again&lt;/p&gt;, &lt;div&gt;&lt;span&gt;And Again&lt;/span&gt;&lt;/div&gt; ]</result></examples><examples><desc>Find the very next sibling of each paragraph that has a class "selected".</desc><before>&lt;p&gt;Hello&lt;/p&gt;&lt;p class="selected"&gt;Hello Again&lt;/p&gt;&lt;div&gt;&lt;span&gt;And Again&lt;/span&gt;&lt;/div&gt;</before><code>$("p").next(".selected")</code><result>[ &lt;p class="selected"&gt;Hello Again&lt;/p&gt; ]</result></examples></method><method cat='DOM/Traversing' type='jQuery' short='Get a set of elements containing the unique previous siblings of each of thematched set of elements.' name='prev'><desc>Get a set of elements containing the unique previous siblings of each of thematched set of elements.Can be filtered with an optional expressions.It only returns the immediately previous sibling, not all previous siblings.</desc><params type='String' name='expr'><desc>(optional) An expression to filter the previous Elements with</desc></params><examples><desc>Find the very previous sibling of each paragraph.</desc><before>&lt;p&gt;Hello&lt;/p&gt;&lt;div&gt;&lt;span&gt;Hello Again&lt;/span&gt;&lt;/div&gt;&lt;p&gt;And Again&lt;/p&gt;</before><code>$("p").prev()</code><result>[ &lt;div&gt;&lt;span&gt;Hello Again&lt;/span&gt;&lt;/div&gt; ]</result></examples><examples><desc>Find the very previous sibling of each paragraph that has a class "selected".</desc><before>&lt;div&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/div&gt;&lt;p class="selected"&gt;Hello Again&lt;/p&gt;&lt;p&gt;And Again&lt;/p&gt;</before><code>$("p").prev(".selected")</code><result>[ &lt;div&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/div&gt; ]</result></examples></method><method cat='DOM/Traversing' type='jQuery' short='Get a set of elements containing all of the unique siblings of each of thematched set of elements.' name='siblings'><desc>Get a set of elements containing all of the unique siblings of each of thematched set of elements.Can be filtered with an optional expressions.</desc><params type='String' name='expr'><desc>(optional) An expression to filter the sibling Elements with</desc></params><examples><desc>Find all siblings of each div.</desc><before>&lt;p&gt;Hello&lt;/p&gt;&lt;div&gt;&lt;span&gt;Hello Again&lt;/span&gt;&lt;/div&gt;&lt;p&gt;And Again&lt;/p&gt;</before><code>$("div").siblings()</code><result>[ &lt;p&gt;Hello&lt;/p&gt;, &lt;p&gt;And Again&lt;/p&gt; ]</result></examples><examples><desc>Find all siblings with a class "selected" of each div.</desc><before>&lt;div&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;/div&gt;&lt;p class="selected"&gt;Hello Again&lt;/p&gt;&lt;p&gt;And Again&lt;/p&gt;</before><code>$("div").siblings(".selected")</code><result>[ &lt;p class="selected"&gt;Hello Again&lt;/p&gt; ]</result></examples></method><method cat='DOM/Traversing' type='jQuery' short='Get a set of elements containing all of the unique children of each of thematched set of elements.' name='children'><desc>Get a set of elements containing all of the unique children of each of thematched set of elements.Can be filtered with an optional expressions.</desc><params type='String' name='expr'><desc>(optional) An expression to filter the child Elements with</desc></params><examples><desc>Find all children of each div.</desc><before>&lt;p&gt;Hello&lt;/p&gt;&lt;div&gt;&lt;span&gt;Hello Again&lt;/span&gt;&lt;/div&gt;&lt;p&gt;And Again&lt;/p&gt;</before><code>$("div").children()</code><result>[ &lt;span&gt;Hello Again&lt;/span&gt; ]</result></examples><examples><desc>Find all children with a class "selected" of each div.</desc><before>&lt;div&gt;&lt;span&gt;Hello&lt;/span&gt;&lt;p class="selected"&gt;Hello Again&lt;/p&gt;&lt;p&gt;And Again&lt;/p&gt;&lt;/div&gt;</before><code>$("div").children(".selected")</code><result>[ &lt;p class="selected"&gt;Hello Again&lt;/p&gt; ]</result></examples></method><method cat='DOM/Manipulation' type='jQuery' see='append(&lt;Content&gt;)' short='Append all of the matched elements to another, specified, set of elements.' name='appendTo'><desc>Append all of the matched elements to another, specified, set of elements.This operation is, essentially, the reverse of doing a regular$(A).append(B), in that instead of appending B to A, you're appendingA to B.</desc>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -