473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,397 developers and data experts.

Browser Quirk: Dynamically appended checked checkbox does not appear checked (IE)

acoder
16,027 Expert Mod 8TB
Problem
Dynamically appended checkbox element does not appear checked despite setting the checked property state to true or "checked".

Browser
Internet Explorer

Example
The Javascript code:
Expand|Select|Wrap|Line Numbers
  1. var cb = document.createElement("input");
  2. cb.type = "checkbox";
  3. cb.name = "checkbox1";
  4. cb.id = "cbID";
  5. cb.checked = true;
  6. obj.appendChild(cb);
Solution
Use defaultChecked instead of checked:
Expand|Select|Wrap|Line Numbers
  1. cb.defaultChecked = true;
Alternative Solution
Set the checked state after appending the checkbox:
Expand|Select|Wrap|Line Numbers
  1. obj.appendChild(cb);
  2. cb.checked = true;
More Bugs, Quirks and Inconsistencies
Aug 18 '07 #1
0 12712

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: lehmann | last post by:
Hello, I discovered that in a form with checkboxes input, if the checkboxe is not checked, not value is sent in my request by the browser (at least IE, I think it is ok in NS). But I my...
4
by: Terry | last post by:
I have a number of input boxes used to display totals based on selected items for each row in a table. There are more than a few rows that are identical, except for the form field name. I have...
4
by: Sileesh | last post by:
Hi I have datagrid with 8 items. Out of which 2 items are checkboxes. Data is binded dynamically to the datagrid Based on some values from the database I have to check or uncheck the checkbox...
1
by: dx | last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as simple as setting oCheckBox.Checked = True.. yet for some reason it isn't. I have a user control (ascx) that that has a...
4
by: david | last post by:
I have an array of CheckBoxes which dynamically display in a web form. How to detect and determine which CheckBox' check status changed? For example, Array(i, j) from checked to Unchecked and...
4
by: sydney.luu | last post by:
Hello, I would greatly appreciate if someone can show me how to dynamically build a Repeater with unknown number of columns at design time. I have looked various threads in this newsgroup,...
4
by: sydney.luu | last post by:
Hello All, I am programmatically building a table on my web page with one row and two columns. The first column contains a web server checkbox dynamically created and the second column simply...
9
acoder
by: acoder | last post by:
Don't you just hate it when you've got something working in every browser (that you've tested on) except the XYZ browser? It would be a good idea to document some strange or incorrect behaviours...
0
acoder
by: acoder | last post by:
Problem The table, when appended dynamically, does not appear on the page. Browser Internet Explorer Example The Javascript code: var obj = document.getElementById("someObjectID"); var...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.