jQuery Dropdown Example
<!DOCTYPE html>
<html>
<head>
<title>Dropdown</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#dropdown").change(function(){
if($("#dropdown").val()=="rajkot"){
alert("Your City is Rajkot");
}
});
$("#button").click(function(){
if($("#dropdown").val()=="select"){
alert("Please Select City");
}
});
$("#dropdown").change(function(){
if($("#dropdown").val()=="surendranagar"){
alert("Your City is Surendranagar");
}
});
});
</script>
</head>
<body>
<form id="form">
<select id="dropdown">
<option value="select">Select</option>
<option value="surendranagar">Surendranagar</option>
<option value="rajkot">Rajkot</option>
</select>
<input type="submit" value="Submit" id="button">
</form>
</body>
</html>
<html>
<head>
<title>Dropdown</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#dropdown").change(function(){
if($("#dropdown").val()=="rajkot"){
alert("Your City is Rajkot");
}
});
$("#button").click(function(){
if($("#dropdown").val()=="select"){
alert("Please Select City");
}
});
$("#dropdown").change(function(){
if($("#dropdown").val()=="surendranagar"){
alert("Your City is Surendranagar");
}
});
});
</script>
</head>
<body>
<form id="form">
<select id="dropdown">
<option value="select">Select</option>
<option value="surendranagar">Surendranagar</option>
<option value="rajkot">Rajkot</option>
</select>
<input type="submit" value="Submit" id="button">
</form>
</body>
</html>
Comments
Post a Comment