Hello friends..
I have a text box I need to validate that..
I mean user can only Enter Either A or B or C if he enters D to Z or any other things I should show the Popup message please Enter A or B or C
Using Jquery or javascript?
thanks
Hello friends..
I have a text box I need to validate that..
I mean user can only Enter Either A or B or C if he enters D to Z or any other things I should show the Popup message please Enter A or B or C
Using Jquery or javascript?
thanks
user regular expression.
<script>
function validat(str)
{
if(/^[A-C]*$/i.test(str)==true)
{
//allow your code
}
else
{
alert("please enter only abc");
}
}
</script>
Do you really need to allow user input via a text box?
I would suggest making use of a set of radio buttons instead of a text box in that situation.
<form>
<label for="A">A</label><input type="radio" name="A" value="A" />
<label for="B">B</label><input type="radio" name="B" value="B" />
<label for="C">C</label><input type="radio" name="C" value="C" />
</form>