Skip to main content

Bug Tracker

Side navigation

#12613 closed bug (notabug)

Opened September 26, 2012 09:43AM UTC

Closed September 27, 2012 01:06AM UTC

set input size property in IE 6.7

Reported by: ZhongleiQiu <zhongleiqiu@gmail.com> 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 ...

Attachments (0)
Change History (1)

Changed September 27, 2012 01:06AM UTC by dmethvin comment:1

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.