Get value from button - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Button

Description

Get value from button

Demo Code

ResultView the demo in separate window

<html lang="en">
   <head></head>
   <body translate="no"> 
      <button onclick="confirmDelete(this)" value="True" name="deleteButton">Delete </button> 
      <script>
      function confirmDelete(elem) {

    var theValue = elem.value;//  ww  w  . ja v a2  s  .c o m
    if (theValue == "True") {
        console.log("True");
    } else {
        console.log("False");
    }
}
    
      </script>  
   </body>
</html>

Related Tutorials