我在学习示例中使用了var foo和var $foo,但无法区分它们:
<p id="css">CSS (Cascading Style Sheets) is a representation style sheet language.</p>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
<script>
$(document).ready(function(){
var js = "<p id='js'>JavaScript often abbreviated as JS, is a high-level, interpreted programming language.</p>";
var $jquery = $("<p id='jquery'>jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML.</p>");
$("#css").after(js);
$("#css").after($jquery);
})
</script>在上面的最小代码中,当执行像$().html, $().before()这样的插入操作时,它们的功能是相同的。
https://stackoverflow.com/questions/51412112
复制相似问题