改變css
function changeColor2(a){
$(a).siblings().css('backgroundColor','#fff');
$(a).siblings().css('color','#F6442C');
$(a).css('backgroundColor','#F6442C');
$(a).css('color','#fff');
}
改變屬性
$("button").click(function(){
$("img").attr("width","180");
});
html(),val(),text()
html(), 相當(dāng)于 innerHTML
text(), 相當(dāng)于 innerTEXT
val() 只有有value屬性的才能取到值
1.<input type='text' value='xxx'/> 這個(gè)就需要用 val()余黎。
$("button").click(function(){
$(":text").val("Hello World");
});
2.<span>你好</span> 這個(gè)就用 text()。
$(".btn1").click(function(){
$("p").text("Hello world!");}
3.<div><p>您好!</p></div> 這個(gè)就用html()歌焦。
$('.add-twenty').on('click',function(){
$(".text_box").val(20);}