Hi,
I wanted to know how to restrict value of a field using javascript. For example, if I want LENGTH field to have only value as either 10, 20 or 30 I use below javascript code -
Element attribute as -
onchange="javascript:Check_Value(this);"
Javascript code as -
function Check_Value(pThis) {
var myvalue = $(pThis).val();
if (myvalue == "10" || myvalue == "20" || myvalue == "30" ) {
}
else
{
alert("Invalid value");
return false;
}
}
However, it will only alert me if value is not as expected, but still continues to next field. I wanted to know, how to restrict my control to same field unless the proper value is given? Please help.
Thanks,
-Anand