Common function to Validate the string length of two characters

Home Forums Web Development HTML, JavaScript and CSS Common function to Validate the string length of two characters

Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by  AdminC 4 years, 6 months ago.

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

    AdminC
    Member

    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.