Remove part of string in text box - Javascript jQuery

Javascript examples for jQuery:String

Description

Remove part of string in text box

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-1.8.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from w  w  w.  j  a  v  a  2 s .  co m*/
var val = $(".name").val();
$(".name").val(val.substring(1, val.indexOf("00:00:00")-1));
    });

      </script> 
   </head> 
   <body> 
      <input class="name" value="12/12/2001 00:00:00">  
   </body>
</html>

Related Tutorials