Skip to main content

Bug Tracker

Side navigation

#13738 closed bug (notabug)

Opened April 05, 2013 06:14PM UTC

Closed April 05, 2013 08:25PM UTC

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

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

Attachments (0)
Change History (1)

Changed April 05, 2013 08:25PM UTC by gibson042 comment:1

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-