从JSON模式创建表单,如何添加关闭按钮
Created forms from JSON Schema, How to add Close button?
有了这个https://github.com/joshfire/jsonform我已经创建了Form.
$('form').jsonForm({
schema: {
name: {type: 'string', title: 'Name', required: true},
//age: {type: 'number', title: 'Age', required: true},
comment: {type: 'textarea', title: 'Comments', required: true},
choice: {type: 'string',title: 'Title', 'enum': ['choice-1','choice-2','choice-3']},
},
onSubmit: function (errors, values) {
if (errors) {
$('#res').html('<p>I beg your pardon?</p>');
}
else {
$('#res').html('<p>Hello ' + values.name + '.' +
(values.comment ? '<br/>You are ' + values.comment + '.' : '') +
'</p>');
}
}
});
在此默认情况下,会出现"提交"按钮。
但我想添加"关闭"按钮。
或者我如何删除或隐藏默认"提交"按钮,以便添加其他提交和关闭按钮?
$('form').jsonForm({
...code
});
// Save reference to parent element to append custom buttons
var btn-container = $('form input[type=submit]').parent();
// Remove default 'submit' button
$('form input[type=submit]').remove();
// now add custom buttons in btn-container
相关文章:
- 映射:如何在infotemplate中添加关闭按钮
- 从JSON模式创建表单,如何添加关闭按钮
- 在覆盖和关闭按钮或链接中为img添加边框
- 添加关闭按钮以自动弹出窗口
- 添加一个按钮,用于关闭带有弹出窗口.js的弹出窗口
- 如何添加关闭按钮脚本
- 如何在jQuery推送侧面板中添加关闭按钮
- 在对话框标题栏中的“关闭”按钮旁边添加按钮
- 如何在图像底部添加带有“x”按钮的横幅以在 React/HTML 中关闭它
- 动态添加一个关闭按钮(Javascript)
- JQuery动态添加了javascripts标签关闭按钮
- 添加一个关闭按钮
- jQuery Mobile:在自定义选择结束时添加关闭按钮
- 添加一个关闭按钮到html5视频
- jQuery在元素上动态添加关闭按钮
- 使元素悬停时取消悬停,添加关闭按钮,使其记住cookie
- 如何在inner.HTML文本中添加关闭按钮
- 如何在Modal Box(Lightbox)Typo3扩展中添加关闭按钮
- 同位素添加关闭按钮
- 如何向从缩略图打开的图像添加关闭按钮