<p> @Html.Label("lblName", "Name")<br /> @Html.TextBox("txtName") <n style="display: none; font-weight: bold;">Only alphabets allowed</n> </p>
$(document).ready(function () { $("#txtName").change(function () { var regex = /^[a-zA-Z]*$/; var Name= $("#txtName").val(); if (!regex.test(Name)) { $('n').css('color', 'red'); $('#txtName').css("border", "solid 1px red"); $('n').show(); } else { $('#txtName').css("border", "solid 1px #BBBBBB"); $('n').hide(); } }); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)