1、html() 取出或設(shè)置html內(nèi)容
// 取出html內(nèi)容
var $htm = $('#div1').html();
// 設(shè)置html內(nèi)容
$('#div1').html('<span>添加文字</span>');
2期奔、text() 取出或設(shè)置text內(nèi)容
// 取出文本內(nèi)容
var $htm = $('#div1').text();
// 設(shè)置文本內(nèi)容
$('#div1').text('<span>添加文字</span>');
3侧馅、attr() 取出或設(shè)置某個(gè)屬性的值
// 取出圖片的地址
var $src = $('#img1').attr('src');
// 設(shè)置圖片的地址和alt屬性
$('#img1').attr({ src: "test.jpg", alt: "Test Image" });