我有表格..在那种形式我点击预览按钮时有预览按钮我显示一个弹出窗口..
当用户在点击预览按钮后输入值我希望在我的弹出窗口中显示这些值..(在提交之前)在codeigniter中请帮我在codeigniter中做到这一点..谢谢你
现在我想在提交表单之前看到给定数据的预览弹出窗口..
<div class="modal-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel ">
<div class="panel-heading hidden_color">NOTIFICATION</div>
<div class="panel-body">
<form role="form" class="form-horizontal" action="javascript:;"> <!-- form horizontal acts as a row -->
<!-- normal control -->
<div class="form-group mod_mr20">
<label class="col-md-3 control-label">Subject</label>
<div class="col-md-7 col-md-offset-1 hidden_color">
<p></p>
</p>
</div>
</div>
<div class="form-group mod_mr20">
<label class="col-md-3 control-label">Expires By</label>
<div class="col-md-7 col-md-offset-1 hidden_color">
<p></p>
</div>
</div>
<div class="form-group mod_mr20">
<label class="col-md-3 control-label">Notice visible to</label>
<div class="col-md-7 col-md-offset-1 hidden_color">
<p></p>
</div>
</div>
<div class="form-group mod_mr20">
<label class="col-md-3 control-label">Attach Files</label>
<div class="col-md-7 col-md-offset-1 hidden_color">
<p></p>
</div>
</div>
<div class="form-group mod_mr20">
<label class="col-md-3 control-label">Notice Description</label>
<div class="col-md-7 col-md-offset-1 hidden_color">
<p></p>
</div>
</div>
<div class="clearfix ">
<div class="col-md-offset-10 col-md-2">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">CLOSE</button>
</div>
</div>
</form>
</div>
</div>
</div> <!-- #end col-left -->
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
答案 0 :(得分:0)
$(document).on ('keyup','#kp', function () {
var value=$(this).val();
$('#kpview').val(value);
});
$(document).on ('change','#selectbox', function () {
var selectval=$(this).val();
$('#resultselect').val(selectval);
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Key Pressed: <input type="text" id="kp" />
Char val: <input type="text" id="kpview" /><br/>
<select id="selectbox"><option value="option1">option one</option> <option value="option2">option two</option></select>
<select id="resultselect"><option value="option1">option one</option>
<option value="option2">option two</option></select>
&#13;
非常简单。只需序列化(如果提交预览按钮)时为您的表单提供 ID 和 >表单数据并将其存储在变量中。您可以专门将每个输入数据附加到模态的特定部分,或者只需在$ .each中重复它。
<form id="form"></form>
<script>
//$('#form').submit() or
$( "#previewbtn" ).click(function() {
var arr=[]; //array
arr= $('form').serialize(); // serialize that form
$('modalfields').html(arr.specificfield);
or
$.each( arr, function(key,value ) {
$('modalfields').html(value);
});
});
</script>
注意:如果我做了一些语法错误,请更正我,因为我不是Pro:D。