Handle changing form attributes correctly when there is a child element with the same name. Fixes #4299
This commit is contained in:
parent
d3dc2d1234
commit
841f9ff7a1
2 changed files with 9 additions and 2 deletions
|
@ -218,7 +218,13 @@ jQuery.extend({
|
|||
if ( name == "type" && /(button|input)/i.test(elem.nodeName) && elem.parentNode ) {
|
||||
throw "type property can't be changed";
|
||||
}
|
||||
elem[ name ] = value;
|
||||
// browsers index elements by id/name on forms, give priority to attributes.
|
||||
if( jQuery.nodeName( elem, "form" ) ) {
|
||||
// convert the value to a string (all browsers do this but IE) see #1070
|
||||
elem.setAttribute( name, "" + value );
|
||||
} else {
|
||||
elem[ name ] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// browsers index elements by id/name on forms, give priority to attributes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue