addClass和removeClass

eg:

$("button").addClass("animated bounce");

$(".well").addClass("animated shake");

$("#target3").addClass("animated fadeOut");

$("button").removeClass("btn-default");

 

 

修改css:

$("#target1").css("color","red");

 

修改html元素属性:

$("#target1").prop("disabled",true);

 

修改元素内部的html和文本内容:html和text

$("#target4").html("<em>jQuery Playground</em>");

$("#target3").text("hello target");

 

删除元素:remove

$("#target4").remove();

 

appendTo:

$("#target2").appendTo("#right-well"); //Move your target2 element from yourleft-well to your right-well. 用appendTo会删除原来位置的元素

 

clone():

$("#target5").clone().appendTo("#left-well");//Clone your target5 element and append it to your left-well.clone 会保持原来的元素,在其原来的位置

 

parent():选择父元素

children():选择所有的子元素

 

选择特定的某个元素:

$(".well:nth-child(2)").addClass("animated bounce");

 

posted on 2017-07-29 15:09  yyy_鸳鸯  阅读(393)  评论(0编辑  收藏  举报