How to open a Bootstrap modal window using jQuery?

后端 未结 15 2297
闹比i
闹比i 2020-11-22 06:46

I\'m using Twitter Bootstrap modal window functionality. When someone clicks submit on my form, I want to show the modal window upon clicking the \"submit button\" in the fo

15条回答
  •  梦谈多话
    2020-11-22 07:44

    Bootstrap has a few functions that can be called manually on modals:

    $('#myModal').modal('toggle');
    $('#myModal').modal('show');
    $('#myModal').modal('hide');
    

    You can see more here: Bootstrap modal component

    Specifically the methods section.

    So you would need to change:

    $('#my-modal').modal({
        show: 'false'
    }); 
    

    to:

    $('#myModal').modal('show'); 
    

    If you're looking to make a custom popup of your own, here's a suggested video from another community member:

    https://www.youtube.com/watch?v=zK4nXa84Km4

提交回复
热议问题