jQuery API | jQuery API 中英文对照版 - jQuery在线查询手册 |
$(elements) |
$(elements)
为一个或多个DOM元素捆绑jQuery功能。 这个函数也可以接收XML文档和Window对象(虽然它们不是DOM元素)作为有效的参数。 返回值: jQuery 参数:
与 $("div > p") 相同。 HTML 代码: <p>one</p> <div><p>two</p></div> <p>three</p> jQuery 代码: $(document).find("div > p") 结果: [ <p>two</p> ] 示例2: 把页面的背景颜色设置为黑色。 Sets the background color of the page to black. jQuery 代码: $(document.body).background( "black" ); 示例3:隐藏表单中的所有input元素。 Hides all the input elements within a form jQuery 代码: $( myForm.elements ).hide() Wrap jQuery functionality around a single or multiple DOM Element(s). This function also accepts XML Documents and Window objects as valid arguments (even though they are not DOM Elements). Return value: jQuery
Example: Sets the background color of the page to black. $(document.body).css( "background", "black" ); Example: Hides all the input elements within a form $( myForm.elements ).hide() |