Use the value property to get the value of a button in JavaScript.
Example
You can try to run the following code to find the value of a button −
<!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; var str2 = document.getElementById("btn").value; document.write("Button text: "+str1); document.write("<br>Button value: "+str2); </script> </body> </html>