选择器修改样式

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");

 

转载于:https://www.cnblogs.com/ycherry/p/7255985.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值