Toggle text of a button on click Jquery - Javascript jQuery

Javascript examples for jQuery:Form Button

Description

Toggle text of a button on click Jquery

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){//from   www. j a v  a 2  s. co m
$("#btnedit").click(function (e) {
    $(this).val("Edit" ? "Cancel" : "Edit");
});
    });

      </script> 
   </head> 
   <body> 
      <input type="button" id="btnedit" value="Edit">  
   </body>
</html>

Related Tutorials