最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - $(modalEl).modal('show') and $(modalEl).modal('hide') not working - Stack Overflow

programmeradmin1浏览0评论

I am using bootstrap-modal from :

modalEl is the modal element in DOM. Modal is pletely rendered in the with some dynamic content.

I want to hide the modal, do some work on application and would like to render that same modal later again without initialising the any new modal.

How do i do that???

I have removed data-dismiss="modal" attribute from the button.

but the following not working in my case

$(modalEl).modal('hide');

$(modalEl).modal('show');

I am using bootstrap-modal from :

https://github./jschr/bootstrap-modal

modalEl is the modal element in DOM. Modal is pletely rendered in the with some dynamic content.

I want to hide the modal, do some work on application and would like to render that same modal later again without initialising the any new modal.

How do i do that???

I have removed data-dismiss="modal" attribute from the button.

but the following not working in my case

$(modalEl).modal('hide');

$(modalEl).modal('show');
Share Improve this question edited Nov 30, 2013 at 7:39 codeofnode asked Nov 30, 2013 at 7:28 codeofnodecodeofnode 18.7k30 gold badges88 silver badges146 bronze badges 2
  • what do you mean by "not working"? What steps have you taken to debug the problem? – Stephen Thomas Commented Nov 30, 2013 at 14:45
  • sorry i was using default approach of twitter bootstrap while using bootstrap-modal.js from different vender. – codeofnode Commented Nov 30, 2013 at 19:49
Add a ment  | 

1 Answer 1

Reset to default 3

'bootstrap-modal.js' provided from https://github./jschr/bootstrap-modal is at least little different if pared from the default modal provided from twitter bootstrap.

for the modal root div (here taken as modalEl)

to show hide default twitter bootstrap we use :

    $(modalEl).modal(); // initialize
    $(modalEl).modal('hide'); // hide
    $(modalEl).modal('show'); //show

However if we use modal from https://github./jschr/bootstrap-modal we should use the following way :

var modalObj = $(modalEl).modal(); // initialize
modalObj.modal('hide') // to hide
modalObj.modal('show') // show
发布评论

评论列表(0)

  1. 暂无评论