Side navigation
#1957 closed bug (invalid)
Opened November 22, 2007 12:41PM UTC
Closed November 27, 2007 08:12PM UTC
Last modified December 09, 2012 03:09PM UTC
changing type property on an input fails in IE
Reported by: | altwind | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.2.2 |
Component: | core | Version: | 1.2.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jquery1.2.1 bug
A following code doesn't work.
<input type="text" id="#some_form_element"> // change 'type' attribute $('#some_form_element').attr( 'type' , 'button' );
and Error Message that
"uncaught exception: type property can't be changed"
from FireBug.
Attachments (0)
Change History (3)
Changed November 27, 2007 08:12PM UTC by comment:1
milestone: | 1.2.1 → 1.2.2 |
---|---|
priority: | major → minor |
resolution: | → invalid |
status: | new → closed |
summary: | jquery1.2.1 bug → changing type property on an input fails in IE |
Changed December 09, 2012 01:07PM UTC by comment:2
[Codepanel.org] Says:
In this case, you can use .prop() function instead
$('_pass').removeAttr("type");
$('_pass').prop('type', 'password');
prop() function represents the properties of the element.
Changed December 09, 2012 03:09PM UTC by comment:3
Wrong. http://i.imgur.com/1KlgO.png
This is a known issue. Please see the example in the documentation here:
http://docs.jquery.com/Core/jQuery#html
And reference:
http://msdn2.microsoft.com/en-us/library/ms534700.aspx
The important line being:
"As of Microsoft Internet Explorer 5, the type property is read/write-once"
so once it is set that's it.
The exception is actually thrown by jQuery so isn't a bug but a feature letting the coder know that doesn't work.