change value of input type="Button" from edit to save - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Button

Description

change value of input type="Button" from edit to save

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>editsavebutton</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
function edit_row(element1) {/*  ww  w . j a v a  2s. c  o m*/
   if (element1.value === "edit") {
      element1.value = "save";
    } else {
      element1.value = "edit";
   }
}

      </script> 
   </head> 
   <body> 
      <input type="button" value="edit" class="edit-btn" onclick="edit_row(this);">  
   </body>
</html>

Related Tutorials