Bug Tracker

Modify

Ticket #1957 (closed bug: invalid)

Opened 6 years ago

Last modified 17 months ago

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:
Blocking: Blocked by:

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.

Change History

comment:1 Changed 6 years ago by davidserduke

  • Priority changed from major to minor
  • Status changed from new to closed
  • Summary changed from jquery1.2.1 bug to changing type property on an input fails in IE
  • Resolution set to invalid
  • Milestone changed from 1.2.1 to 1.2.2

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.

comment:2 Changed 17 months ago by Dheeraj Bansal

[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.

comment:3 Changed 17 months ago by dmethvin

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.