Bootstrap modal - close modal when “call to action” button is clicked

后端 未结 5 1976
一向
一向 2021-02-06 20:36

I have a external link inside my modal, and I want the modal to hide after the user has clicked on the link. How do I do that?

Here is my code:

5条回答
  •  一个人的身影
    2021-02-06 21:07

    Use data-dismiss="modal". In the version of Bootstrap I am using v3.3.5, when data-dismiss="modal" is added to the desired button like shown below it calls my external Javascript (JQuery) function beautifully and magically closes the modal. Its soo Sweet, I was worried I would have to call some modal hide in another function and chain that to the real working function

     Yes
    

    In some external script file, and in my doc ready there is of course a function for the click of that identifier ID

     $("#divExamListHeader").on('click', '#btnReleaseAll', function () {
                   // Do DatabaseMagic Here for a call a MVC ActionResult
    

提交回复
热议问题