Saturday, September 22, 2012

Jquery - Changing select option value text


HTML:
======
<select id="slider1" data-role="slider" data-mini="true" data-theme="d">
    <option value="on">Madras</option>
    <option selected="selected" value="off">Coimbatore</option>
</select>


Jquery:
======
//I want to change the display value "Madras" to "chennai"
$("#slider1").next().children().first().text("Chennai");

//I want to change the display value "Coimbatore" to "Kovai"
$("#slider1").next().children().first().next().text("Kovai");