- $("#btnGetCode").click(function(){
- var a = '<!DOCTYPE html><html lang="zh-cn">';
- var z = "</html>"
- var by = $(":root").html();
- $("#codeView").val(a+by+z);
- });
- $(":root") 选择器为根选择器
- 它总是从<html>开始
- //该片段来自于http://www.codesnippet.cn/detail/2503201511980.html
来源: http://www.codesnippet.cn/detail/2503201511980.html