jquery validation for alphabets character. Here you want to check first character alphabets in textbox. Give a ID name in text box and text alphabel balue use [a-zA-Z] this. Follow example code for better understand.
jQuery Code:
<script type="text/javascript"> var myText = function(tval){ var TextVal = tval.value; if(!/[a-zA-Z]/.test(TextVal)){ tval.value = ""; $('#PenErr').text('*First character start with Alphabet.'); return false; } } </script>
Html code:
<label id="PenErr"></label> <input type="text" placeholder="Pen Name" class="form-control" name="pen" id="pen" onkeydown="javascript:myText(this)">
Question and answer is powered by AnsPress.io