zoukankan      html  css  js  c++  java
  • 选择器修改样式

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

  • 相关阅读:
    最长上升子序列问题总结
    Problem C
    Problem C
    Problem P
    Problem P
    Problem H
    Problem H
    Problem D
    Problem D
    Linux系统调用--getrlimit()与setrlimit()函数详解
  • 原文地址:https://www.cnblogs.com/ycherry/p/7255985.html
Copyright © 2011-2022 走看看