I want to show the value of the attribute as a parameter
答案 0 :(得分:0)
我假设你想获得div元素的value
属性。您可以使用Element.getAttribute():
myFunction = function (event) {
document.getElementById('hi').value = event.target.getAttribute('value');
}

<div onclick="myFunction(event)" value="50">
click me
</div>
<input id="hi">
&#13;