使用 jQuery,如何从通过操作 DOM 添加的字段中获取表单数据?

发布于 2024-08-24 22:27:43 字数 140 浏览 2 评论 0原文

我有一个表主体,可以通过 AJAX 在各种事件上获取其行(和表单字段)。一切工作正常,除了一部分:在操作表后,我无法从任何表行获取表单数据。

我已经尝试过 live() 函数,但我似乎无法获得正确的设置来提取表单数据。

有什么想法吗?

I have a table body that grabs it's rows (and form fields) via AJAX on various events. Everything is working fine, except one part: I can't obtain form data from any of the table's rows after it gets manipulated.

I've played around with the live() function, but I can't seem to get the right setup to pull in the form data.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

余生一个溪 2024-08-31 22:27:43

DOM 中的所有内容都可以从 jquery 访问,无论它是如何添加/操作的。

如果您想要更详细的答案,请向我们展示一些您所做的事情和想要做的事情的代码...

everything inside the DOM is accessible from jquery no matter how it got added/manipulated..

Show us some code of what you do and what you want to do if you want a more detailed answer...

无人接听 2024-08-31 22:27:43

我在我的代码中发现了这个问题。重建表后,我的字段名称与在页面加载时构建表时使用的字段名称略有不同。

感谢您的快速回复。

I found the issue in my code. Upon rebuilding the table, I had a slightly different field name for the fields than I used when building the table on page load.

Thank you for your quick responses.

放我走吧 2024-08-31 22:27:43

听起来您可能需要重构该代码,以便在页面加载时构建表的相同代码稍后也会重建它。

It sounds like you may need to re-factor that code such that the same code that builds the table at page load also rebuilds it later on.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文