I have a modal with a button 'open prompt':
<div class="modal fade" id="test" 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">Arquivo</h4>
</div>
<div class="modal-body">
<a href="javascript:my_prompt();" class="button">Open prompt</a>
</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 -->
And the my_prompt function:
function my_prompt()
{
alertify.prompt( 'Prompt', function (e, str) {}, "" );
}
When I show the modal with $('#test').modal('show');
and click to open the prompt, they both appears, but the alertify can not be edited. And if I press ESC key, they both disappear.
Anybody had this problem too? Is there a solution?
I have a modal with a button 'open prompt':
<div class="modal fade" id="test" 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">Arquivo</h4>
</div>
<div class="modal-body">
<a href="javascript:my_prompt();" class="button">Open prompt</a>
</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 -->
And the my_prompt function:
function my_prompt()
{
alertify.prompt( 'Prompt', function (e, str) {}, "" );
}
When I show the modal with $('#test').modal('show');
and click to open the prompt, they both appears, but the alertify can not be edited. And if I press ESC key, they both disappear.
Anybody had this problem too? Is there a solution?
Share Improve this question edited Feb 18, 2014 at 12:30 johnkavanagh 4,6742 gold badges27 silver badges37 bronze badges asked Jan 30, 2014 at 16:07 Ratata TataRatata Tata 2,8791 gold badge37 silver badges49 bronze badges 2- For me is working fine: jsfiddle/IrvinDominin/PC7k4 – Irvin Dominin Commented Jan 30, 2014 at 16:36
- In this example, in the prompt you can type something? I open in my chrome and firefox (mac) and doesn't work for me. I can't even focus the prompt input text. – Ratata Tata Commented Jan 30, 2014 at 17:11
1 Answer
Reset to default 7The issue is related to the presence of tabindex="-1"
in your modal div.
By removing it will work fine, I'm searching for side effects, but for now I have found any issue.
Demo: http://jsfiddle/IrvinDominin/PC7k4/2/