2
I was trying to clear the selected option from the checkbox - <select>
using Javascript. In this checkbox I am using the plugin Choosen.
I saw an answer in Stack Overflow, and I’ve 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');
};
});
However I still can’t 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 clear the option selected in the combobox?
for
????– Jéf Bueno
What is it? What problem? @LINQ
– UzumakiArtanis
What is the reason for this tag?
– Jéf Bueno
I thought it was appropriate @LINQ.
– UzumakiArtanis
But why? I don’t understand the relationship of the question with
for
– Jéf Bueno
tidy up there, I forgot to save
– AnthraxisBR
https://jsfiddle.net/bxuxk9p2/4/
– AnthraxisBR