Click here to Skip to main content
16,018,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I'm designing an MVC4 web portal. In that for a particular textbox I'm not supposed to allow 2 specific words like "Product", "Registered", "ProductRegistered" ... How do i achieve this? I want to do it on client side... (javascript or Jquery)?

Any sample code will be appreciated... Thank you!!
Posted
Comments
So, how you want to do that?
When somebody copy and paste it on the TextBox or after writing the whole word by keys, you want to remove it?
vishnutejcj 13-Jun-13 12:55pm    
Dash,

Thanks for the reply.

On "Focus out" should help..
Please check my answer.

Refer to below link that can help you a bit.

certain words in a text box, disable the submit button[^]

And if you have only two word then just check for the text of that textbox in textbox_textchanged event(set autopostback="true" on textbox)

Regards... :laugh:
 
Share this answer
 
v3
Hi vishnutejcj,

Check the Demo - [Demo] Restrict words in TextBox[^].

I have used mouseout event, you can use any event as per your requirement.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900