I need to reset couple of select2 select element. Currently i am doing it as follows
$("#ItemId").select2("val", "");
$("#PermanentDistrictId").select2("val", "");
$("#PermanentThanaId").select2("val", "");
$("#PresentDistrictId").select2("val", "");
$("#PresentThanaId").select2("val", "");
$("#OccupationId").select2("val", "");
$("#GenderId").select2("val", "");
But i would like to do it in single function like as follows-
ParticularForm.AllSelectElements.select2("val", "");
I am asking here as because my javascript skill is very poor. So, I need your help.
Thank you.
$(".select2-hidden-accessible").val(null).trigger("change");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With