以下代码之间的真正区别是什么:
<p>Maizere1</p>
<p>Maizere2</p>
<p>Maizere3</p>
<script>
$("p").text($(this).text()).get(0);
vs
$("<p>").text($(this).text()).get(0);//actually this line is what giving me trouble
what does $("<p>"> this do?
i heard that $("<p>") will first actually check where the element exist or not ,if not only will create element
最佳答案
$('<p>')
不是有效的 jquery selector但它会创建一个 <p>
我认为这不是您要在这里解决的问题。
关于javascript - jquery选择元素的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14712227/