Select string after a specific symbol in javascript/Jquery - Javascript jQuery

Javascript examples for jQuery:Selector

Description

Select string after a specific symbol in javascript/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-1.4.2.js"></script> 
      <script type="text/javascript">
    $(function(){/*from   w  w w.ja  v a 2s . c o  m*/
var haystack = "this is a @moo";
if (haystack.indexOf("@")) {
    console.log(haystack.substr(haystack.indexOf("@") + 1));
}
    });

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

Related Tutorials