kartik-v / yii2-widgets

Collection of useful widgets for Yii Framework 2.0
http://demos.krajee.com/widgets
Other
558 stars 175 forks source link

clear selection via jquery #294

Closed quackadillyblip closed 8 years ago

quackadillyblip commented 8 years ago

How can i clear a selected value programmatically via jquery?

i tried something like this? $(this).find(".select2-selection__clear").click();

but this doesn't seem to do it? any suggestions?

quackadillyblip commented 8 years ago

fixed; $(this).select2().val("").trigger("change");

yogi9096 commented 4 years ago

This is worked for me-

$('#accessories').val('').trigger("change"); //#accessories is the id of select2