首页javascriptbackgroundjQuery Style - 如何更改页面背景颜色按钮单击

jQuery Style - 如何更改页面背景颜色按钮单击

我们想知道如何更改页面背景颜色按钮单击。


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.11.0.js'></script>
<script type='text/javascript'>
$(window).load(function(){
    $( "#change_background" ).on( "click", function() {
        $("body").first().css("background-color","red");
    });
});
</script>
</head>
<body>
  <input type="button" id="change_background" value="Change background" />
</body>
</html>