jQuery & boostrap: What does fn[NAME] do?

I am going through the javascript code for bootstrap.

In modal.js I see:

  $.fn[NAME]             = Modal._jQueryInterface
  $.fn[NAME].Constructor = Modal

Where NAME is 'modal' What does $.fn[NAME] do? I know what plain $.fn is, not sure about the [NAME] and thee .Contractor.

Answers 1

  • It is same as doing $.fn.modal = Modal._jQueryInterface but using [] notation instead of dot notation

    Creates a plugin function to allow you to do $(selector).modal()

Related Articles