Bug Tracker

Opened 7 years ago

Closed 7 years ago

#12613 closed bug (notabug)

set input size property in IE 6.7

Reported by: ZhongleiQiu <zhongleiqiu@…> Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:

Description

When I'm in IE 6,7, use $('#someinput').attr('size', '20px'), IE will show error. I dig in jQuery 1.8.2, and find the code like this:

Use this for any attribute in IE6/7 This fixes almost every IE6/7 issue

nodeHook = jQuery.valHooks.button = {

get: function( elem, name ) {

...

},

set: function( elem, value, name ) {

var ret = elem.getAttributeNode( name );

if ( !ret ) {

ret = document.createAttribute( name ); elem.setAttributeNode( ret );

} return ( ret.value = value + "" );

}

};

So, 'return (ret.value = value + "" )' should become 'return (ret.value = parseInt(value, 10) + "") '

Sorry for my bad English ...

Change History (1)

comment:1 Changed 7 years ago by dmethvin

Resolution: notabug
Status: newclosed

The size attribute of an input element requires a numeric value without units. To set the width of the element to 20 pixels, use .width("20px"). It would be wrong to call parseInt on every attribute value.

Note: See TracTickets for help on using tickets.