jquery 控制 insertBefore(content)
insertBefore(content)将匹配元素集合插入到匹配元素集合‘content’之前
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><script src="http://code.jquery.com/jquery-latest.js"></script> <script>$(document).ready(function(){ $("p").insertBefore("#foo"); // check before() examples});</script><style>#foo { background:yellow; }</style></head><body><div id="foo">FOO!</div><p>I would like to say: </p></body></html>
$("p").insertBefore("#foo"); // check before() examples
将匹配p元素集合插入到属性值为‘foo’的匹配元素之前。
页:
[1]