Contents () to find matching elements inside all child nodes (including text nodes). If the element is an iframe, then find the document content

contents()

V1.2 Overview

Find matching internal elements of all child nodes (including text nodes). If the element is an iframe, then find the document content

 

Examples

Description: marble platform test procedures

Find all text nodes and bold

HTML code:
<p>Hello <a href="http://ejohn.org/">John</a>, how are you doing?</p>
jQuery code:
$("p").contents().not("[nodeType=1]").wrap("<b/>");
result:
<p><b>Hello</b> <a href="http://ejohn.org/">John</a>, <b>how are you doing?</b></p>

description:

An empty frame to add some content

HTML code:
<iframe src="/index-blank.html" width="300" height="100"></iframe>
jQuery code:
$("iframe").contents().find("body")
  .append("I'm in an iframe!");

Guess you like

Origin www.cnblogs.com/furuihua/p/12018079.html
Recommended