javascript - alertify upon a bootstrap modal not working - Stack Overflow

I have a modal with a button 'open prompt':<div class="modal fade" id="test

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">&times;</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">&times;</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
Add a ment  | 

1 Answer 1

Reset to default 7

The 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/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745145900a4613645.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信