Why display SELECT value is not changing?

Posted by I'll-Be-Back on Stack Overflow See other posts from Stack Overflow or by I'll-Be-Back
Published on 2012-09-28T09:09:08Z Indexed on 2012/09/28 9:37 UTC
Read the original article Hit count: 290

Filed under:
|

When the page load, I expected <option value="B">B</option> value to change to red. It didn't work. Why?

jQuery

$(document).ready(function () {
  $('[name=HeaderFields] option[value="B"]').val('red');
} 

Dropdown:

<select name="HeaderFields" style="width:60px">
    <option value="A">A</option>
    <option value="B">B</option>
    <option value="C">C</option>
</select>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery