首页javascriptcss_attributejQuery Style - 如何更改CSS属性

jQuery Style - 如何更改CSS属性

我们想知道如何更改CSS属性。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.8.3.js'></script>
<style type='text/css'>
div {
  color: red;
}

.shown {
  color: blue;
}
</style>
<script type='text/javascript'>
$(window).load(function(){
    var thing = $('div')
    thing.addClass('shown');
});
</script>
</head>
<body>
  <div>test</div>
</body>
</html>