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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:23:08+00:00 2026-06-11T23:23:08+00:00

I have written JQuery that adds a CSS attribute to a button when it

  • 0

I have written JQuery that adds a CSS attribute to a button when it detectes an element with a specific CSS class: (in this case, when a validation div is displayed on a page)

  <script>
        $(document).bind('DOMSubtreeModified', function () 
        {
            if ($('.errors').length)
            {
            alert('test');
            }
        });
    </script>

The alert is displayed in every browser (including IE8 and 9) but not IE7 – is this a known issue? Does anyone know of an alternative that could be used?

Edit: I have discovered IE7 can’t execute ‘DOMSubtreeModified‘. And I can see there are alternatives but the javascript needs to be called automatically and detect when a change has occurred, and not executing it using a call to a function. Any suggestions?

Another Edit: As it’s a .NET MVC website, I can’t see how to add a javascript call to the validation binding. Is there a way for javascript to detect changes on the whole page? i.e javascript code that can do the same as the above code?

  • 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-11T23:23:10+00:00Added an answer on June 11, 2026 at 11:23 pm

    If it only gets called when there’s a validation error, then why use such a broad event as DOMSubtreeModified? I would use a custom event like this:

    function validate() { 
      var error = false;
      //....
      //your validation code that finds an error
      if(error) {
        $(document).trigger('validationError');
      }
      //.....
    }
    
    
    $(document).on('validationError',function() {
       //your code that does something when an error is found
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written this simple bit of jQuery that swaps out the containing ul's
I have written a JQuery program that, on the press of a button, runs
I have written a bit of jQuery that hides a certain element on page
I have a master page that adds the jquery library via a registerclientscriptinclude: Page.ClientScript.RegisterClientScriptInclude(this.GetType(),
I have written two jQuery functions, the simplified version of which run thus: $('button.class').not('.selected').on('click',
I have written a script that fires a jQuery POST to retrieve data from
I have written a cascading drop down list using JQuery. The code that I
I have a modal dialog plugin written in jquery, that binds to the click
I have written a simple jQuery script that changes the hash tag of a
I have written a short jquery method that on the keypress event of a

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.