Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8434685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:43:30+00:00 2026-06-10T06:43:30+00:00

For the modal code inside the twitter bootstrap.js plugin, I see this: e =

  • 0

For the modal code inside the twitter bootstrap.js plugin, I see this:

e = $.Event('show')
this.$element.trigger(e)

Why don’t they just do $.element.show()?

Why is the jQuery Event constructor being used?

Here is the show method from the source:

show: function () {
   var that = this
      , e = $.Event('show')

    this.$element.trigger(e)

    if (this.isShown || e.isDefaultPrevented()) return

    $('body').addClass('modal-open')

    this.isShown = true

    escape.call(this)
    backdrop.call(this, function () {
      var transition = $.support.transition && that.$element.hasClass('fade')

      if (!that.$element.parent().length) {
        that.$element.appendTo(document.body) //don't move modals dom position
      }

      that.$element.show()

      if (transition) {
         that.$element[0].offsetWidth // force reflow
      }

      that.$element.addClass('in')

      transition ?
        that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
        that.$element.trigger('shown')

    })
  }

Could someone explain this to me clearly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:43:32+00:00Added an answer on June 10, 2026 at 6:43 am

    That’s Because it’s giving us the opportunity to react to the event.

    thanks to this, if you want react when modal its going to open you only should add an event listener:

    $("#myModal").on("show", function () {
        console.log("Do stuff on 'show'");
    });
    

    Just to be clear. they created an event called “show” but can be any name since its used only for that plugin. Even if they had called “showme-the-money” you shoud only listen that event:

    $("#myModal").on("showme-the-money", function () {
        console.log("Sorry i'm poor :(");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Twitter bootstrap modal doesn't load external urls inside modal. Sample Code : jsFiddle <a
I am testing this simple code below and it works... $(document).ready( function() { $('.show-modal').click(
I have trouble with some code I just wrote. Basically, this code is inside
I have a Google Maps Autocomplete input field inside a Twitter Bootstrap modal dialog
I have the following code; // open the modal when an element with a
I have a textarea element inside of a jquery modal dialog that has an
When I click on this checkbox (inside the Modal form) <input id=selectallcreate type=checkbox value=1
trying to create a form inside a modal dialog. But i would like this
Jquery UI Dialog modal-form doesn't shows up inside table, but works fine outside. This
I have some HTML code with a dialog inside, like this: <center> <a href=#add_auto

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.