javascript - How to get a value from textarea within modal popup? -
there http://jsfiddle.net/wv5e7/ modal copy/pasted , working right now.
here code: js
$('#mymodal').on('shown.bs.modal', function () { $('#textareaid').focus(); })
html:
<!-- button trigger modal --> <button class="btn btn-primary btn-lg launch-modal" data-toggle="modal" data-target="#mymodal"> launch modal </button> <!-- modal --> <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="mymodallabel">modal title</h4> </div> <div class="modal-body"> <textarea id="textareaid" class="form-control"></textarea> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> <button type="button" class="btn btn-primary">save changes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
it works seen in demo, when hits 'save changes' can't seem value of text area inside it.
i did
$('#textareaid').val();
but, there not value, since trying value before save changes button clicked.
so, not know how value of text submited using jquery
try this,
$("#mymodal").find('#textareaid').val();
Comments
Post a Comment