[ jquery 属性 .context ] 返回传给jQuery()的原始的DOM节点内容
返回传给jQuery()的原始的DOM节点内容:即jQuery()的第二个参数。如果没有指定,那么context指向当前的文档(document),可以与selector一起使用,用于精确检测选择器查询情况
实例:
<!DOCTYPE html>
<html lang='zh-cn'>
<head>
<title>Insert you title</title>
<meta http-equiv='description' content='this is my page'>
<meta http-equiv='keywords' content='keyword1,keyword2,keyword3'>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- <script type='text/javascript' src='./js/jquery-3.0.0.js'></script> -->
<script type='text/javascript' src='./js/jquery-1.12.1.min.js'></script>
<style type='text/css'>
</style>
<script type='text/javascript'>
$(function(){
$("ul")
.append("<li>" + $("ul").context + "</li>")
.append("<li>" + $("ul", document.body).context.nodeName + "</li>");
});
</script>
</head>
<body>
<ul id='listDemo'>
<li>list_01</li>
<li>list_02/li>
<li>list_03</li>
<li>list_04</li>
</ul>
</body>
</html>