jquery 控制 before(content)
before(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").before("<b>Hello</b>");});</script><style>p { background:yellow; }</style></head><body><p> is what I said...</p></body></html>
$("p").before("<b>Hello</b>");
在匹配p元素集合中每一个p元素之前加上新的内容‘<b>Hello</b>’。
页:
[1]