万能的JQUERY
<li id="listItem"> This is some text <span id="firstSpan">First span text</span> <span id="secondSpan">Second span text</span> </li>
HTML代码结构如上,想要得到"listItem"第一级的文字,也就是"This is some text"。
方法如下:
$("#listItem")
.clone() //clone the element
.children() //select all the children
.remove() //remove all the children
.end() //again go back to selected element
.text();
万能的JQUERY啊!!!
致力于SharePoint开发.
QQ:28748451.
浙公网安备 33010602011771号