1猎醇、獲取內(nèi)容
.html()
var something=$('ul').html();
$('ul').append(something);```

var something=$('li').html();
$('li').append('<i>'+something+'</i>');
只返回第一個(gè)< li >元素中的內(nèi)容;
$('li').each(function(){
var something=$(this).html();
$(this).append(something);
})```
返回每一個(gè)< li >元素中的內(nèi)容
效果2.png
.text()
同上努溃,不過返回值是< ul >或者< li >元素中的文本內(nèi)容硫嘶。
2、修改內(nèi)容
$(function(){
$('li:contains("sss")').text('almonds');
$('li.red').html(function(){
return'<em>'+$(this).text()+'</em>';
})
$('#id1').remove();
});```

3梧税、添加新內(nèi)容
---------------------------------------------
$(function(){
$('ul').before('<p class="blue">舉個(gè)栗子</p>');
$('li.red').prepend('+ ');
var b=$('<li>re7rt<em>ke</em>p</li>');
$('li:last').after(b);
});```
效果4.png
獲取和設(shè)置css屬性
.css()方法
.css('background-color');
.css('background-color','#565656')
.css({
'background-color':'#167253',
'color':'#267536',
'font-size':'15px'
})
$(function(){
var backgroundColor=$('li').css('background-color');
$('ul').append('<p>Color was: '+backgroundColor+'</p>');
$('li').css({
'background-color': '#c5a996',
'border':'1px solid #fff',
'color':'#000',
'font-family':'Georgia',
'padding-left':'+=75'
}) ;
});
修改多個(gè)css屬性及屬性值時(shí)沦疾,用逗號(hào)“,”隔開,'屬性1':'屬性值1','屬性2':'屬性值2';當(dāng)修改單個(gè)屬性和屬性值時(shí)---'屬性','屬性值'
而<p>標(biāo)簽內(nèi)容的backgroundColor對應(yīng)css屬性background-color的值會(huì)以RGB的形式返回。