
I want to validate textbox based on dropdown menu consisting of many options. For eg Dropdown consists of option (1,2,3,4) if "1" is selected textbox should validate a value 0f "2300" through a submit button "Evaluate". Please give me the sample code for the above problem using only javascript

Here is an example that validate the textbox value.
<HTML>
<SCRIPT>
function validate(){
var v=document.getElementById("t").value;
var e = document.getElementById("sel");
var st = e.options[e.selectedIndex].text;
if(st=="1"&&v!="2300"){
alert("Value should be 2300!");
document.getElementById("t").value=" ";
}
}
</SCRIPT>
</HTML>
<form name="f" onsubmit="return validate();">
<pre>
<select id="sel">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input type="text" id="t">
<input type="submit" value="submit">
</html>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.