Validate Jar file name - Javascript String Operation

Javascript examples for String Operation:String Parse

Description

Validate Jar file name

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script type="text/javascript">
function my()/*from w w  w  . ja  va 2 s. c om*/
{
    var id_value = "validate.jar"; //Let I assume this
    if(id_value != '')
    {
          if(id_value.lastIndexOf(".jar") != -1)
          {
               console.log('OK');
          }
          else
          {
               console.log('Invalid File')
          }
    }
}
my();

      </script>  
   </body>
</html>

Related Tutorials