我有一个列表框和一个特定的选定值,我想显示一个下拉列表,并从下拉列表中选择一个值,我想显示另一个下拉列表。jquery change event without postback
我已经实现了这个使用jQuery的,但下拉菜单后才显示回发。如何避免回传?
这是我的jQuery代码
<script type="text/javascript">
$(document).ready(function() {
if ($('#<%=under_list1.ClientID %> option:selected').val() == 0) {
$("#ddl_nature1").show();
$("#ddl_gross1").hide();
if ($('#<%=ddl_nature.ClientID %> option:selected').val() == 'I', $('#<%=ddl_nature.ClientID %> option:selected').val() == 'E') {
$("#ddl_gross1").show();
}
else {
$("#ddl_gross1").hide();
}
}
else {
$("#ddl_nature1").hide();
$("#ddl_gross1").hide();
}
});
under_list1是我的列表框的ID,ddl_nature1是我的第一个下拉列表和ddl_gross1是我的第二个下拉。
从您的代码后面和从aspx页面发布代码。您可以在下拉菜单中将AutoPostBack设置为false。 – 2012-02-22 08:49:25