Votre code est correct (bien que Darryl La réponse de Hein est plus facile à taper), donc il doit y avoir un autre problème.
Où est votre code JS?
Est-il à l'intérieur d'un doc prêt? ==> `$ (fonction() {...});
est-jQuery inclus, etc.
Voici un fully working HTML page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title> - jsFiddle demo</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.4.2.js'></script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css"/>
<link rel="stylesheet" type="text/css" href="/css/result-light.css"/>
<style type='text/css'>
body {
background-color: transparent;
padding: 10px;
}
</style>
<script type='text/javascript'>
//<![CDATA[
$(function() {
$("#request_showdate_1i option[value='2012']").attr("selected","selected");
});
//]]>
</script>
</head>
<body>
<form>
<select name="request[showdate(1i)]" id="request_showdate_1i">
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010" selected="selected">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
</select>
<form>
</body>
</html>
Est-ce la question intitulée 'Quand le monde va se terminer' :) lol – Marko
@marko, ce que vous faites pense donc :) –