php - How to deselect single checked checkbox in multiselect widget? -
i want deselect checked checkbox in multiselect widget automatically. performing click event on checkbox of multiselect widget. , after clicking checkbox sending request php page through ajax checking result. if got result giving alert user. , after alert want deselect checkbox automatically.i provifing code. jquery code :
$("#multiselectunittype").multiselect("widget").on('click',':checkbox',function(e) { $.ajax({ url: "checkforentry2.php", type: "post", data: { chargetype : $('#ddlchargetype').val() }, success: function(data, textstatus, jqxhr) { if(data == "no") { } else { alert(data); $(this).prop('checked',false); } } }); }); so please tell me how should ?
by default, context object represents ajax settings used in call ($.ajaxsettings merged settings passed $.ajax).
so here $(this) represents ajax settings
you can add hack
$("#multiselectunittype").multiselect("widget").on('click',':checkbox',function(e){ var $element=$(this); $.ajax({ url: "checkforentry2.php", type: "post", data:{ chargetype : $('#ddlchargetype').val() }, success: function(data, textstatus, jqxhr){ if(data == "no"){ }else{ alert(data); $($element).prop('checked',false); } } }); }); or can use context option in ajax setting:
context: this, success:fuction(){ $(this).prop('checked',false); }
Comments
Post a Comment