yorickshan
9/5/2018 - 3:32 AM

CSS 常用属性及设置

CSS常用属性

$("#centerMaster_button").css('display', 'inline');

$("#list_dispaly").css("display", "none");

$("#master_update_button").css({ "opacity": "0.65", "pointer-events": "none" });

通过jQuery设置属性

//attr
$(document).ready(function(){
    $("button").click(function(){
        $("img").attr("width","500");
    });
});
//prop
$("#confirm_button").prop("disabled", false);

jquery中prop()方法和attr()方法的区别浅析

//addClass
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $('p').addClass(function(n){
      return 'par_' + n;
    });
  });
});
</script>
<style type="text/css">
.par_0
{
color:blue;
}
.par_1
{
color:red;
}
</style>