本文介紹了如何使用 jQuery 選擇的插件重置表單?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我在一個表單中有一堆 select
元素,我正在使用Jquery 選擇插件.如何重置表格?以下方法不起作用:
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" />
推薦答案
您需要重置該字段的值,然后在輸入上觸發 liszt:updated
事件以獲取它更新,我在這里做了一個工作示例.
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");
});?
自選擇的 v1.0 發布以來,觸發器現在稱為選擇:更新".使用此新版本的任何人都需要使用觸發更新
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");
這篇關于如何使用 jQuery 選擇的插件重置表單?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!