JQuery的一些基本知识
jQuery 是一个快速、小巧且功能丰富的 JavaScript 库。它简化了 HTML 文档遍历、事件处理、动画和 Ajax 交互。jQuery 的设计宗旨是“write less, do more”,即用更少的代码做更多的事情。
点击查看代码
// DOM 操作
$('#myElement').html('Hello, World!');
// 事件处理
$('#myButton').click(function() {
alert('按钮被点击了!');
});
// 动画
$('#myElement').fadeIn();
// Ajax 请求
$.ajax({
url: 'my-api-url',
type: 'GET',
success: function(data) {
console.log(data);
},
error: function(xhr, status, error) {
console.error(error);
}
});
浙公网安备 33010602011771号