Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
144
rated 0 times [  149] [ 5]  / answers: 1 / hits: 101606  / 13 Years ago, wed, october 26, 2011, 12:00:00

I have a bunch of select elements in a form with which I am using the Jquery Chosen plugin. How can I reset the form? The following does not work:



<input type="reset" />

More From » jquery

 Answers
2

You'll need to reset the value of the field, then trigger the liszt:updated event on the input to get it to update, ive made a fiddle with a working example here.



http://jsfiddle.net/VSpa3/3/



$(.chzn-select).chosen();
$('a').click(function(){
$(.chzn-select).val('').trigger(liszt:updated);
});​


Since the release of chosen v1.0 the trigger is now called 'chosen:updated'. Anyone using this new version needs to trigger the update using



$(.chosen-select).val('').trigger(chosen:updated);

[#89448] Sunday, October 23, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tomas

Total Points: 165
Total Questions: 111
Total Answers: 103

Location: Maldives
Member since Tue, Dec 21, 2021
2 Years ago
tomas questions
Thu, Jan 27, 22, 00:00, 2 Years ago
Mon, May 10, 21, 00:00, 3 Years ago
Tue, Jan 5, 21, 00:00, 3 Years ago
;