Bug Tracker

Opened 7 years ago

Closed 7 years ago

#13738 closed bug (notabug)

Problem to define Attr to a select > option tag in Google Chrome

Reported by: gomidefabio@… Owned by:
Priority: undecided Milestone: None
Component: attributes Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

Hi! I am trying to define Attr to a select > option tag in Google Chrome, using jQuery 1.9.1. It works fine on Firefox 19.0.2 and Opera 12.14, but not on Chrome Version 26.0.1410.43 nor on Safari 6.0.1. This is the code:

<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Test</title> </head> <body> <form>

<select>

<option value="11">aa</option> <option value="22">bb</option> <option value="33">cc</option> <option value="44">dd</option>

</select>

</form> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script>

$(function(){

$('select option:last').attr('selected','selected');

});

</script> </body> </html>

Change History (1)

comment:1 Changed 7 years ago by gibson042

Component: unfiledattributes
Resolution: notabug
Status: newclosed

Use .prop to update the dynamic selectedness of options. http://jquery.com/upgrade-guide/1.9/#attr-versus-prop-

Note: See TracTickets for help on using tickets.