<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
div{
width: 100px;
height: 100px;
background-color: pink;
}
</style>
</head>
<body>
<div></div>
<script src="js/jquery-1.12.4.js"></script>
<script src="jquery.bgColor.js"></script>
<script>
//更改div的背景颜色
$("div").css("backgroundColor", "hotpink");
//封装一个添加背景颜色的方法
// $.fn.bgColor = function (color) {
// this.css("backgroundColor", color);
// }
console.log($("div").bgColor("purple").width());
</script>
</body>
</html>