the text input only allows three words separated by spaces, and if it exceeds 3, the user can\'t input anymore, is this possible using jQuery? I can use keyup event to liste
May be something like,
$('#myTextbox').change(
function()
{
var input = $(this).val();
var numberOfWords = input.split(' ').length;
if(numberOfWords > 3)
{
$(this).val(input.substring(0, input.lastIndexOf(' ')-1));
}
}
);
I haven't verified this code, but something like this should work.
And yes, as mgroves said, don't forget to re-validate everything on the server.