3
我必须在有多个输入需要由用户输入表单之前显示在表单中输入的数据,但在提交表单之前,我希望向用户显示其自己的I/P将如何获得显示。提交表单
我的页面分为两个部分,一部分包含表单和2包含布局
<form class="form-horizontal" enctype="multipart/form-data" role="form" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="POST">
<div class="form-group">
<label for="input01" class="col-sm-2 control-label">First Name</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="firstname" id="input01">
</div>
</div>
<div class="form-group">
<label for="input01" class="col-sm-2 control-label">Last Name</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="lastname" id="input02">
</div>
</div>
<div class="form-group">
<label for="input01" class="col-sm-2 control-label">Location</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="location" id="input03">
</div>
</div>
</form>
现在我要显示上面的数据会有所不同DIV的地方,这需要做前提交按钮,例如:
我想这
when user types firstname, at the same instance it should be displayed under <div id="firstname"></div>,
when user types lastname , at the same instance it should be displayed under <div id="lastname "></div>,
when user types location, at the same instance it should be displayed under <div id="location"></div>,
目前,我有作品只为单个输入
代码<input type="text" value="">
<p></p>
$("input")
.keyup(function() {
var value = $(this).val();
$("p").text(value);
})
.keyup();
但我想要的东西可以适用于任何数量的输入,如上面的示例中所述。任何人都可以请帮助我吧
它显示的I/P只有1项,u能请提供一个小提琴 – ne1902
澄清请。你使用什么代码。 –
我用的第一个,bcoz的ID将是差异为每格 – ne1902