jQuery-仅通过引用传递的元素? JS-Bin $(文档).ready(函数(){ var p=$(“#你好”); $(p).文本(“是”); }); hello World
上面的代码改变了jQuery-仅通过引用传递的元素? JS-Bin $(文档).ready(函数(){ var p=$(“#你好”); $(p).文本(“是”); }); hello World,jquery,Jquery,上面的代码改变了元素中的文本,但这是否合理? 因为它已经有了两组元素。如果我理解了这个问题(20%的确定性),那么答案是否定的,您不需要第二次将p包装为JQuery对象 <html> <head> <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <meta charset=utf-8 /&
元素中的文本,但这是否合理?
因为它已经有了两组
元素。如果我理解了这个问题(20%的确定性),那么答案是否定的,您不需要第二次将p
包装为JQuery对象
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<script type="text/javascript">
$(document).ready(function () {
var p = $('#hello');
$(p).text('Yes');
});
</script>
</head>
<body>
<p id="hello">Hello World</p>
</body>
</html>
或
很好。如果我理解了这个问题(20%的确定性),答案是否定的,您不需要第二次将p
包装为JQuery对象
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<script type="text/javascript">
$(document).ready(function () {
var p = $('#hello');
$(p).text('Yes');
});
</script>
</head>
<body>
<p id="hello">Hello World</p>
</body>
</html>
或
很好。抱歉@SilverNight。。。你说“因为它已经有两套元素了”是什么意思?我想他有两套
element抱歉@SilverNight。。。你说“因为它已经有两套元素了”是什么意思?我想他有两套元素
$(document).ready(function () {
$('#hello').text('Yes');
});