I’m reading a cookie to select a list item on page load (the cookie IS coming back–just to make sure, I hard-coded it and the select still didn’t work). Nothing gets selected. Here’s the code:
HTML
<select id="Carriers" size="20">
<option value="0">Anaheim</option>
<option value="0">CCMSI</option>
<option value="0">City of Newport Beach</option>
<option value="0">City of Santa Ana</option>
<option value="0">Guard</option>
<option value="1">Staffmark</option>
</select>
JS
$(document).ready(function () {
var cookie = getCookie(CookieName);
if (cookie != null) {
$("#Carriers").val(cookie);
}
});
Edit: It doesn’t work in IE8 or in Chrome.
Use unique values…
http://jsfiddle.net/QdHB9/