I have many textboxes/textarea in my webforms. Now i want to make a generic jQuery function which will do the following things and validations on keyPress/KeyDown .
1- On calling the function on any input area i would like to pass 3 parameters on that function. 1- That specific field ID , 2- Number of characters allowed , 3- Error Message to display.
2- Upon execeding of limit prescribed in any input areas function it must validate that user's entered character must not exceed that limit , and if exceeding then it must not allowed to input anything. and also show a jQuery pop up showing the error message which i had prescribed while calling function.
3- after showing error message in pop up when user clicks on OK , then it must focus on that specific textbox from where error was raised.
the e.g would be like this :
<input type="text" runat="server" clientidmode="static" id="field1" onkeypress="ValidateMe("field1",15,"Please enter firstname field")" />
<input type="text" runat="server" clientidmode="static" id="field2" onkeypress="ValidateMe("field2",10,"Please enter last name field")" />
function ValidateMe(ID,Limit,Mesg)
{
// please describe coding for this
}