Common function to Validate the string length of two characters


Viewing 1 post (of 1 total)
  • Author
  • #4931

    I have several input html controls that need to validate their value length. Means they should not be have greater than two characters.

    I have written the function in javascript for one control. I want to write the generic function so that i can use that function for all input controls.

    function CheckCharLength()
    if(document.getElementById("txtstate").value.length < 2) { alert("Enter Valid State Code"); document.getElementById("txtstate").focus(); return false; } }

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.