Cancel key down, press, up event in PHP javascript, C#

I want to cancel out key press event when my textarea field gets n number of characters from user. At that point i dont want user to enter any more characters. What to do?


I need it to be done in javascript as well as in php


In web pages, NobleCount is one possibility. Seems to be the most robust of the jQuery plugin solutions. It will give your user a count of the number of characters remaining, Twitter-style.

See also:

Interactive character limit for textarea using Jquery

In Winforms, you would set Handled in the KeyPressEventArgs to true to cancel the KeyPress event. This keeps the control from processing the key press.

Note: Some controls will process certain key strokes on KeyDown. For example, RichTextBox processes the Enter key before KeyPress is called. In such cases, you cannot cancel the KeyPress event, and must cancel the key stroke from KeyDown instead.

Need Your Help

linear programming in python?

python linear linear-programming

I need to make a linear programming model. Here are the inequalities I'm using (for example):