0

我需要根据服务器的 Ajax 响应动态生成整个 html 表单。作为响应,将提供诸如输入类型、输入标签、验证(如果有)等信息。

表单最多总是有十个字段。

是否有任何 jQuery/javascript 工具/插件来生成表单?

谢谢。

4

1 回答 1

0

形成

从他们的例子:

    value = {"key":"value"} "key" will be the value attribute and "value" will be the shown value of the element. If the array is constructed like {"value",value","value"} (without keys) then the value attribute of the input will be an auto-incremented number starting from 0.
options = {} See options table below.

$.fn.formation(options); [Create a form]
$.formation.addInput(options); [Append an input]
$.formation.addSelect(values,options); [Append a select]
$.formation.addTextarea(options); [Append a textarea]
$.formation.addCheckboxes(values,options); [Append an unordered list of checkboxes]
$.formation.addRadios(values,options); [Append an unordered list of radio buttons]
$.formation.addCaptcha(options); [Adds a captcha question to your form]
$.formation.addButton(options); [Append a button]
$.formation.setErrorMessages(options); [Set custom error messages for validation]

但是,这些都是您可以使用 Jquery 轻松完成的事情,而且这是一次很好的学习体验,因此我建议您自己尝试一下。

于 2011-10-12T06:52:47.823 回答