admin管理员组文章数量:1292111
I want to create a Modal Dialog with Bootstrap. I am new in Bootstrap.
how this:
How I can do this and how I get the values from the textfield back.
I want to create a Modal Dialog with Bootstrap. I am new in Bootstrap.
how this:
How I can do this and how I get the values from the textfield back.
Share Improve this question edited May 28, 2015 at 13:38 amphetamachine 30.6k12 gold badges67 silver badges74 bronze badges asked May 28, 2015 at 11:28 TarasovTarasov 3,69519 gold badges72 silver badges128 bronze badges 2- The best way will be to start reading the docs of Bootstrap modals. Are you using ASP.NET or PHP? – Mivaweb Commented May 28, 2015 at 11:34
- 1 I want use javascript – Tarasov Commented May 28, 2015 at 11:43
2 Answers
Reset to default 5Modal is on the same page. So whatever input field you have inside modal is accessible in your page.
For example you have
<input type="text" id="txtName" />
You can simply access it using
$("#txtName").val();
for Modal code. Here it is done
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<input type="text" id="txtname">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
try this:
var name = $('#txtname').val();
for access value from dropdownlist:
You'd have something like:
var plantid = $('.drpplants').get(0).value;
Or
var plantid = $('.drpplants').get(1).value;
本文标签: javascriptHow I can use a Bootstrap Modal Dialog and get the return valuesStack Overflow
版权声明:本文标题:javascript - How I can use a Bootstrap Modal Dialog and get the return values? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741549277a2384780.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论