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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:18:40+00:00 2026-05-10T22:18:40+00:00

The following html code works in Firefox, but for some reason fails in IE

  • 0

The following html code works in Firefox, but for some reason fails in IE (Label2 is not shown). Is that a bug or I miss something?

Any help would be appreciated.

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'> <html>     <head>         <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>         <script src='http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js' type='text/javascript'>         </script>         <script>             jQuery(document).ready(function(){                 function setVis(){                     var val = $('#check').is(':checked');                     if (val)                          $('#g_1').show();                     else                          $('#g_1').hide();                 }                  setVis();                 $('#check').change(setVis);             });         </script>     </head>     <body>         <span>             <input type='checkbox' id='check' />             <label>Label1</label>         </span>         <span id='g_1'>             <label>Label2</label>         </span>     </body> </html> 
  • 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. 2026-05-10T22:18:41+00:00Added an answer on May 10, 2026 at 10:18 pm

    Cause:

    Per MSDN, the change event is

    …fired when the contents are committed and not while the value is changing. For example, on a text box, this event is not fired while the user is typing, but rather when the user commits the change by leaving the text box that has focus.

    Behavior for checkboxes is similar: in IE the event does not fire until focus is removed from the element (try it: click then tab off of the checkbox and behavior is as expected). Firefox apparently does not respect this distinction.

    Solution:

    Use the click event handler instead of change:

                $("#check").click(setVis); 

    …and behavior should be consistent across browsers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason the following code does not work as expected when in IE
I have the following html.erb code that I'm looking to move to Haml: <span
I have a HTML file that has code similar to the following. <table> <tr>
The following Html works great for me in FireFox or IE7/8 (with or without
I'm using the following HTML code to autoselect some text in a form field
The following jQuery works fine in Firefox for me, but failed in IE6: $(<map></map>).attr(name,somevar).appendTo(#someElement);
I have the following html code: <h3 id=headerid><span onclick=expandCollapse('headerid')>&uArr;</span>Header title</h3> I would like to
I have the following code in my file to load a div with HTML
I have the following code <html> <head> <title>Test</title> <style type=text/css> <!-- body,td,th { color:
I am using jQuery and Ajax. My MainFile has the following code: <html> <head>

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.