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 6221561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:09:21+00:00 2026-05-24T08:09:21+00:00

I have defined a $(document).ready() event in Site.Master page and I also want to

  • 0

I have defined a $(document).ready() event in Site.Master page and I also want to define another $(document).ready() in one of my partial view (which is use to display msgs and error msgs), and I am calling this partial view in all pages and all partial view …

the partial views are displayed in the page and also using modal popup … so I tried to this but the ready event in partial view is not firing

I have few things to ask:

  • first, is it possible to do what i am trying to do …
  • there are pages which have partial view and because of it a page has two $(document).ready() events so when the page is loaded, is there be any clashes between these two events …

and if some body can provide wth some example …

  • 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-05-24T08:09:22+00:00Added an answer on May 24, 2026 at 8:09 am

    Yes, you can include multiple ready event handlers on the page. You can put them in the site master, partial views, and view page itself — as many as you need. They must all be enclosed in script tags. They will fire in the order that they are included in the final, rendered page. Note, you want to be careful to make sure that the partial is included only once on the page or that it doesn’t matter if that handler is called multiple times.

    Example (not complete):

    Master:

     <script type="text/javascript" src="jquery.js"></script>
     <script type="text/javascript" src="jqueryui.js"></script>
     <script type="text/javascript">
          $(function() {
               // do something for whole page
          });
     </script>
    
     @Html.Partial( "ErrorDialog" )
    

    Partial (ErrorDialog)

     <div id="errorDialog" style="display: none;" title="Error">
         <p>An error occurred</p>
     </div>
     <script type="text/javascript">
          $(function() {
              $('#errorDialog').dialog({
                 modal: true,
                 autoOpen: false,
                 // more options
              });
          });
    
          function showError(msg) {
              $('#errorDialog').find('p').html(msg)
                               .stop()
                               .dialog('open');
          }
     </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have defined some click event handlers as follows: $(document).ready(function () { /* *
Is it possible to have a defined function as a handler to jQuery's $(document).ready()
I already have a jQuery(document).ready fragment defined. Since I'm working on a large-scale modular
I have define the following SCPD document for my UPnP device: <?xml version=1.0?> <scpd
I have some JavaScript code that is supposed to run on document.ready but I
I have a case where a click handler is defined/assigned in one jQuery code
I have a jQuery code which runs on dom ready. It also creates elements
I have a simple XML document that I want to read into an object
Let's say we have like 3 functions: // Notice there are no $(document).ready function
I have a page with a number of features and styles defined through jQuery

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.