Update Panel .NET

Exploring Microsoft ASP.NET AJAX and jQuery

Posts Tagged ‘WebKit

WebKit Bug! Default value of unchecked checkbox element is an empty string!

with one comment

If you drop a checkbox on a page, without setting the value attribute, for example:

<input type="checkbox" />

Browsers should default the value to the string “on”. To check this, add a “onclick” handler to display the value of the checkbox:

<input type="checkbox" onclick="alert(this.value);" />

Now, test this in the latest versions of Internet Explorer, Firefox, Opera, Chrome and Safari, you will notice that for the first three browsers, the value displayed for both checked and unchecked state is “on” but for Chrome (2) and Safari (4), the value displayed for the unchecked state is an empty string!

Surely this is a bug, because if you did specify a value, for example:

<input type="checkbox" value="foo" onclick="alert(this.value);" />

You will see “foo” displayed in the alert box for both checked and unchecked state on all browsers!

Written by tzkuei

June 10, 2009 at 7:59 pm

Posted in Browser, DOM, HTML

Tagged with