jQuery是一种快速、简洁的JavaScript库,其中 $() 是其主要的调用函数。下面是一些在jQuery中输出语句的方法:
$(document).ready(function() {
console.log("Hello World");
alert():使用 alert() 函数在浏览器弹出警告框并输出语句。例如:
$(document).ready(function() {
alert("Hello World");
text():使用 text() 函数将语句设置为HTML元素的文本内容。例如:
$(document).ready(function() {
$("p").text("Hello World");
这些是jQuery中输出语句的几种方法。