bootstrap modal close after 4 seconds or user click

前端 未结 4 2007
梦谈多话
梦谈多话 2020-12-24 14:49

How would I set a timeout for a bootstrap modal? After getting the ajax data back that the message returned by php contains the term success, I want to give the

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-24 15:15

    When calling setTimeout(), wrap your command in an anonymous function. Otherwise the command will be executed immediately.

    setTimeout(function() {$('#forgot-form').modal('hide');}, 4000);
    

提交回复
热议问题