定义方法

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div>
<span onclick="prime(this)">aaaa</span>
<span>bbbb</span>
<span>cccc</span>
</div>
<script type="text/javascript" src="js/jquery.js" ></script>

<script>
function prime(obj){
var val = $(obj).text();
console.log(val)
}

</script>
</body>
</html>

posted @ 2018-10-22 10:44  heshimei77  阅读(139)  评论(0编辑  收藏  举报