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

  • Home
  • SEARCH
  • 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 7621527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:13:03+00:00 2026-05-31T04:13:03+00:00

I’m not sure if it’s a bug in jQuery, FF/Chrome or IE or just

  • 0

I’m not sure if it’s a bug in jQuery, FF/Chrome or IE or just expected behavior. Unfortunately I don’t know jQuery that well to tell if following script should give the same results under different browsers.

<!DOCTYPE html>
<html>
<head>
    <title>test</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
    <div id="c">
        <form name="login" action="https://my_domain.com/my_login_script.php" method="post">
            <input type="text" name="email" value="sss" />
            <input type="text" name="password" value="pass" />
            <input type="submit" value="go" />
            </form>
    </div>

    <script type="text/javascript">
        $("#c").find('form[name=login]').submit(function() {
            alert($(this).serialize());
            $('#c').html("");
            alert($(this).serialize());
            alert($(this).html()); // empty string in IE, contents of <form> under FF
            return false;
        });
        </script>
</body>
</html>

What it does:

  1. Assigns handler for submit event to form ‘login’ contained in div “#c”
  2. In the event handler form is serialized and displayed in alert box.
  3. Contents of div “#c” is changed to empty string.
  4. Form is again serialized and output string displayed in alert box.
  5. Contents of ‘this’ is displayed in alert box – it’s empty in IE and has some html in FF/Chrome

In FF/Chrome alert boxes show:

  1. email=sss&password=pass
  2. email=sss&password=pass // The same output as above, ‘this’ has not changed?

In IE9 however:

  1. email=sss&password=pass
  2. “” // Empty string

Is it a bug in jQuery?

  • 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-31T04:13:04+00:00Added an answer on May 31, 2026 at 4:13 am

    I’d say it’s more of how the browser handles the .innerHTML property than a jQuery bug (as jQuery calls innerHTML, which the browser would use to construct/reconstruct a DOM tree). See this example: http://jsfiddle.net/bhKCu/1/ (if it were a jQuery bug, that should behave the same no matter which browser as it uses innerHTML instead of $.html() right?).

    From jQuery.html():

    This method uses the browser’s innerHTML property. Some browsers may
    not generate a DOM that exactly replicates the HTML source provided.

    From jQuery 1.7.1:

    html: function( value ) {
            if ( value === undefined ) {
                return this[0] && this[0].nodeType === 1 ?
                    this[0].innerHTML.replace(rinlinejQuery, "") :
                    null;
        // See if we can take a shortcut and just use innerHTML
        } else if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
            (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
            !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
    
            value = value.replace(rxhtmlTag, "<$1></$2>");
    
            try {
                for ( var i = 0, l = this.length; i < l; i++ ) {
                    // Remove element nodes and prevent memory leaks
                    if ( this[i].nodeType === 1 ) {
                        jQuery.cleanData( this[i].getElementsByTagName("*") );
                        this[i].innerHTML = value; // HERE
                    }
                }
    
            // If using innerHTML throws an exception, use the fallback method
            } catch(e) {
                this.empty().append( value );
            }
    
        } else if ( jQuery.isFunction( value ) ) {
            this.each(function(i){
                var self = jQuery( this );
    
                self.html( value.call(this, i, self.html()) );
            });
    
        } else {
            this.empty().append( value );
        }
    
        return this;
    },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into

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.