You must Sign In to post a response.
  • Category: ASP.NET

    How to restrict the special characters being entered in textbox (ASP.Net, C#.Net, jQuery).

    Hi
    How to restrict the special characters being entered in textbox (ASP.Net, C#.Net, jQuery).
    My Current Validation is working as expected [when user types in textbox],
    but the problem is it's getting failed when user Copy Special Characters (#,{,},|) and Paste into the textbox then it's not working.
    How can I prevent the user to Type/Copy Paste Special Characters into my Textbox?

    Please assist me.
    Thanks.
  • #769327
    Hi Yugesh,

    Jquery supports Onpaste Event. You can fire ur validation in this event:

    $('#id').on('paste', function () {

    //Perform your validation logic here or call ur validation funtion

    });

    ~ Hope it helps

    Thanks!
    Anjali Bansal

    ~Give your best and lead the world


  • Sign In to post your comments