当按下按钮而不重新加载时,将HTML表单域添加到现有表单 [英] Add HTML form field to existing form when a button is pressed without reloading

查看:142
本文介绍了当按下按钮而不重新加载时,将HTML表单域添加到现有表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用Google搜索时,我发现了很多 JavaScript 示例。但是,他们都没有为我工作。



我想要实现一个相对简单的任务:通过按下表单中的添加字段按钮,应该显示第二个选择字段。这应该无限期地继续下去。由于我已经在使用 jQuery 库,我宁愿在这里也使用它。



一旦您按下添加字段按钮,页面就不会重新加载。

解决方案

查看样本 如何隐藏,显示或切换您的div


I found quite a few JavaScript examples when googling for this. However, none of them worked for me.

I want to achieve a relatively simple task: By pressing an add field button in a form a second select field should show up. This should go on indefinitely. Since I'm already using the jQuery library, I would prefer to use it here too.

The page should not reload once you press the add field button.

解决方案

Check out the sample How to hide, show, or toggle your div.

这篇关于当按下按钮而不重新加载时,将HTML表单域添加到现有表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆