0

how can I add a function to Bootstraps Modal?

e.g. I want to call:

mymodal.info("foo");

but this funtion obviously doesn't exist for the modal object.

I've included the bootstrap.js and tried to add the function like:

$.fn.modal.prototype.info = function (msg) {
  // test:
  console.log(msg);
}

in a scripts.js (included after bootstrap.js). But this doesn't work...

amphetamachine
  • 27,620
  • 12
  • 60
  • 72
Sandy
  • 1
  • 2
  • Maybe this question helps you: http://stackoverflow.com/questions/9137311/how-to-extend-twitter-bootstrap-plugin – Marcel Herd Jan 18 '15 at 11:31
  • I've tried it with `var _super = $.fn.modal; $.extend(_super.Constructor.prototype.info, function () { console.log('test'); });` But it doesn't work... – Sandy Jan 18 '15 at 11:46

0 Answers0