- 使用JQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>074</title>
<style type="text/css">
#divOne
{
color: red;
}
</style>
</head>
<body>
<div id="divOne">
divOne
</div>
<script type="text/javascript" src="jquery-2.2.4.js"></script>
</body>
<script type="text/javascript">
$(document).ready(function(){
console.log('ready');
$("#divOne").click(function(){
console.log("element clicked");
});
});
</script>
</html>