Thursday 4 December 2014

validation in a drop down list with javascript

<form name="con" method="post" action="" onSubmit="return check()">

<select id="country" name="country">

</form>


<script>
function check(){
if(document.getElementById('country').selectedIndex==0)
{
alert("Please select country"); document.getElementById('country').focus(); return false;
}
}
</script>

No comments:

Post a Comment