Sử dụng thuộc tính value của phần tử <button> để lấy giá trị giá trị (không phải text hiển thị).
Ví dụ
<!DOCTYPE html>
<html>
<body>
<form id="myForm">
<button id="btn" type="button" value="my_button">My Button</button>
</form>
<script>
var str1 = document.getElementById("btn").innerHTML; // text hiển thị
var str2 = document.getElementById("btn").value; // value attribute
document.write("Button text: " + str1);
document.write("<br>Button value: " + str2);
</script>
</body>
</html>