我在一个表单中有一堆 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模板网!
用于创建头像的 jQuery/JavaScript 库?jQuery/JavaScript Library for avatar creation?(用于创建头像的 jQuery/JavaScript 库?)
如何做以下掩码输入问题?How to do following mask input problem?(如何做以下掩码输入问题?)
使用 DropKick Javascript 设置值/标签的问题Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 设置值/标签的问题)
如何对 jquery 插件中的私有方法进行单元测试?how to unit-test private methods in jquery plugins?(如何对 jquery 插件中的私有方法进行单元测试?)
stellar.js - 为垂直滚动网站配置偏移量/对齐元素stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 为垂直滚动网站配置偏移量/对齐元素?)
jQuery 屏蔽输入插件.当文本框获得焦点时选择所有jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽输入插件.当文本框获得焦点时选择所有内容)