Home  >  Article  >  Web Front-end  >  JQuery Study Notes Selector Four_jquery

JQuery Study Notes Selector Four_jquery

WBOY
WBOYOriginal
2016-05-16 18:49:26986browse
复制代码 代码如下:





无标题文档






    

hello word!




    hello





设置内容包含“hello”的节点红色背景颜色
设置无内容的DIV内容设为EmptyDIV
设置包含 p 节点的 div 节点红色背景颜色
设置包含子节点的 div 节点红色背景颜色



First of all, let’s explain the extracurricular knowledge points in this chapter
1.element.css("attributeName","value")
Description: used to set the style of element, in the example $(this) .css("background","red"); is to set the background of the node to red.
Now let’s get to the topic
1.$("TagName:contains('keyword')")
Description: Used to obtain the node collection containing keyword content in all TagName nodes
Return value: Array (Element);
2.$("TagName:Empty")
Description: Used to obtain the node collection with empty content in all TagName nodes
Return value: Array(Element);
3.$("TagName1:has(TagName2))
Description: Used to obtain the node set containing TagName2 child nodes among all TagName1 nodes
Return value: Array(Element);
4.$( "TagName:parent")
Description: Used to obtain the node set including child nodes in all TagName nodes
Return value: Array(Element);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn