Based on this post I tried to create a popover with an input-field which can be opened via a link within a modal.
But for any reason the input and the submit button are disabled. Does anyone know why and how to fix it?
HTML:
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Launch demo modal</button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<a href="#" id="popover">the popover link</a>
<div id='popover-head' class='front hide'>
Lorem Ipsum
</div>
<div id='popover-content' class='content hide'>
<div class='form-group'>
<input type='text' class='form-control' placeholder='Type something…'>
</div>
<button type='submit' class='btn btn-default'>Submit</button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
JS
$('#popover').popover({
html : true,
placement: 'bottom',
title: function() {
return $("#popover-head").html();
},
content: function() {
return $("#popover-content").html();
}
});
$('#myModal').on('shown.bs.modal', function () {
$('#myInput').focus()
})