﻿
function RestrictDescription(str, e)    
{
var keyPressed ;

if(window.event)
keyPressed = window.event.keyCode; // IE hack
else
keyPressed = e.which;

    if(keyPressed == 8 || keyPressed == 0)
        return true;
    var exp = String.fromCharCode(keyPressed)        
    var address=document.getElementById(str);
    //Below line will have the special characters that is not allowed you can add if you want more for some characters you need to add escape sequence       
    var r = new RegExp("^[-_,/'\ .0-9a-zA-Z@\s\r\t]", "g");   
     
  
      if (exp.match(r) == null)     
      {
        if(window.event)
            e.keyCode = 0;
        
        alert(' ~ , !, #, $, %, ^, &, *, +, =, {, }, [, ] , \, |, ?, < , > , (, ), :, ; , "  is Not Allow');
        return false;
     
      }
      else
      {
           return true;    
      }                         
                
            
               
              
} 