我正在尝试使用 jquery 启用下拉菜单并单击搜索,然后该类别页面应该打开。但我可以这样做。当我从“SEARCH BY MAKE”下拉菜单中选择任何一个选项时,下一个“SEARCH BY MODEL”下拉菜单应该启用,这与其他下拉菜单相同。意味着下一个下拉菜单依赖于上一个。当我从最后一个下拉菜单中选择选项时,应该显示搜索按钮,当页面加载时我会隐藏它。我在“SEARCH BY MAKE”中有很多类别。我希望在单击搜索按钮后所有页面都应该动态打开。根据这三个下拉列表,应该打开类别或产品页面。请帮帮我。请检查以下代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<title>Untitled Document</title>
</head>
<body>
<form>
<select id="Make" name="Make" class="criterion">
<option value="">SEARCH BY MAKE</option>
<option value="1">ACURA</option>
<option value="2">INTEGRA</option>
<option value="3">MDX</option>
</select>
</form><br />
<form>
<select id="Model" name="Model" class="criterion">
<option value="">SEARCH BY MODEL</option>
<option value="1">XYZ</option>
</select>
</form><br />
<form>
<select id="Year" name="Year" class="criterion">
<option value="">SEARCH BY YEAR</option>
<option value="1">ABC</option>
</form>
<br />
<input type="submit" value="Search" class="CatsearchButton" />
<script type="text/javascript">
$(document).ready(function() {
$('.CatsearchButton').hide();
var $selects = $('select.criterion');
$selects.not("#Year").on('change', function() {
$selects.each(function() {
var $this = $(this);
var disable = $this.val() == '';
$this.closest('form').nextAll().find('select').prop('disabled', disable);
if (disable) return false;
})
}).eq(0).trigger('change');
$selects.filter('#Year').change(function() {
$('.CatsearchButton').show();
});
});
</script>
</body>
</html>