我有以下Jquery代码
$('#filterPageSearchModel_CarMakeFilter').on('change', function () {
var make = $(this).val();
CreateList(make, '@actionModel', '@idModel');
CreateList(make, '@actionEngineSize', '@idEngineSize');
CreateList(make, '@actionSubModel', '@idSubModel');
CreateList(make, '@actionYear', '@idYear');
CreateList(make, '@actionMarkOrSeries', '@idMarkOrSeries');
});
var CreateList = function (make, action, id, model, engineSize, submodel) {
$('.loader').css('display', 'inline');
// $(DropDownObject).prop("disabled", true);
var Make = make;
var Model = model;
var Id = id;
var EngineSize = engineSize;
var SubModel = submodel;
$.ajax({
url: action,
type: 'GET',
datatype: 'JSON',
data: { Make: Make, Model: Model, EngineSize: EngineSize, SubModel: SubModel },
success: function (result) {
$(Id).html('');
$(Id).append($('<option>Select an Option</option>'));
$.each(result, function (i, item) {
$(Id).append($('<option></option>').val(item.Value).html(item.Text));
});
$(Id).trigger("chosen:updated");
$(Id).val(""); // set value to null
$('.loader').css('display', 'none');
//$(DropDownObject).prop("disabled", false);
}
});
};
我希望在勾选复选框时禁用函数CreateList,或以某种方式隐藏/禁用“onfilterPageSearchModel_CarMakeFilter”的事件“onchange” 显然,如果未勾选复选框,则再次启用这些事件。
答案 0 :(得分:0)
请试试这个:
$('#filterPageSearchModel_CarMakeFilter').on('change', function (){
if(!this.checked) {
var make = $(this).val();
CreateList(make, '@actionModel', '@idModel');
CreateList(make, '@actionEngineSize', '@idEngineSize');
CreateList(make, '@actionSubModel', '@idSubModel');
CreateList(make, '@actionYear', '@idYear');
CreateList(make, '@actionMarkOrSeries', '@idMarkOrSeries');
}
});
答案 1 :(得分:0)
是否有一个复选框或多个复选框? 是&#39; filterPageSearchModel_CarMakeFilter&#39;复选框或影响此的复选框?
只需像这样抓住复选框值...
product = [[0 for i in range(len(b[0]))] for j in range(len(a))]
所以对于这个
$('#check_id').val();