无法获取jquery中的按钮值。如何获取jquery中的按钮值
<head>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js">
</script>
</head>
<body>
<p> This is para </p>
<button> Hide </button>
<script>
function handle(){
value = $("button").attr("value");
alert(value);
}
$(function(){
$("button").click(handle);
});
</script>
什么是上面的代码中的错误。我需要处理由按钮触发的事件,而不是“this”。我已经看到如何使用“this”来解决它。因此,如果没有“this”,如何处理事件
'button'没有'value'属性... –