gpt4 book ai didi

jquery - 提交前显示表单元素值的摘要

转载 作者:行者123 更新时间:2023-12-01 03:00:34 25 4
gpt4 key购买 nike

使用 jquery formtowizard.js 和 ajax 提交。我希望表单的最后一步显示已填写的所有表单字段的摘要。我可以让它在孤立的测试用例中工作,但不能完全使用。表格

<form id="Commission" method="post" action="PHP/CommissionsSubmit.php">
<fieldset id="Initial">
<legend>Enter Your Information</legend>
<ul>
<li>
<label for="FName">First Name*</label><input type="text" name="FName" id="FName">
</li>
//repeat many li's
</ul>
</fieldset>
<fieldset>
<legend>Second Step</legend>
//more li's
</fieldset>
<fieldset>
<legend>Confirmation</legend>
<span id="CFName"></span>
</fieldset>
</form>

jquery 获取“#CFName”值

$('#FName').keyup(function() {
$('#CFName').val($(this).val());
});

我无法让值出现在范围“#CFName”中...这可能与“序列化”函数或我的 $ajax 提交函数中发生的任何事情有关吗?它发生在提交之前...请帮忙!

我很抱歉,但我已经反复将“#CFName”作为跨度和输入,分别使用 .val 和 .html

最佳答案

尝试:$('#CFName').text($(this).val());

The .val() method is primarily used to get the values of form elements such as input, select and textarea.

否则您应该使用.text()

关于jquery - 提交前显示表单元素值的摘要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10844432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com