<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="js/jquery.js"></script>
</head>
<body>
<div id="s2">使用jquery修改div元素的背景色(点击字体即可修改颜色)</div>
<script>
$(function(){
$("#s2").on('click',function(){
$(this).css("background","green");
});
});
</script>
</body>
</html>
来源:https://blog.csdn.net/weixin_45747093/article/details/102778350