JQuery to Avoid Special Character from String in Kendo UI

  1. <!DOCTYPE html>  
  2. <html  
  3.     xmlns="http://www.w3.org/1999/xhtml">  
  4.     <head>  
  5.         <link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1316/styles/kendo.common.min.css" />  
  6.         <link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1316/styles/kendo.default.min.css" />  
  7.         <link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1316/styles/kendo.dataviz.min.css" />  
  8.         <link rel="stylesheet" href="http://cdn.kendostatic.com/2014.3.1316/styles/kendo.dataviz.default.min.css" />  
  9.         <script src="http://cdn.kendostatic.com/2014.3.1316/js/jquery.min.js"></script>  
  10.         <script src="http://cdn.kendostatic.com/2014.3.1316/js/kendo.all.min.js"></script>  
  11.         <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>  
  12.         <title> String Replace</title>  
  13.     </head>  
  14.     <body>  
  15.         <div>  
  16. Enter String:  
  17.             <input type="text" id="txt_msg" class="k-textbox"/>  
  18.             <br />  
  19.             <input class="k-button" type="button" id="btnRemove" value="Remove Special character" onclick="SpecialFunction()" />  
  20.         </div>  
  21.         <script type="text/javascript">  
  22. function SpecialFunction() {  
  23. var Input=$("#txt_msg").val()  
  24. alert((Input.replace(/[^a-zA-Z0-9-. ]/g, "")));  
  25. }  
  26. </script>  
  27.     </body>  
  28. </html>