I was trying to clear the selected option from the - <select>
check box using JavaScript. In this checkbox I'm using the Choosen plugin.
I saw an answer in the Stack Overflow , and I already made the following code:
$("#btnLimpar").click(function(){
$("#editPublication")[0].reset();
var cmb = new Array('#cmbCompany','#cmbType','#cmbTitle','#cmbEmployee','#cmbMonth');
for (var i = 0; i < cmb.length; i++) {
$(i).val('').trigger('chosen:updated');
};
});
I still have not been able to clear the selected option. And if I use:
console.log($(i).val('').trigger('chosen:updated'));
Information similar to this is returned:
r.fn.init {} __proto__: Object(0) [1] 0: 1 length: 1 __proto__: Object(0)
How can I clean the selected option in the combobox ?