Friday, 15 February 2013

javascript - JQuery select browser doesn't update -



javascript - JQuery select browser doesn't update -

i have simple jquery select issue using query mobile have googled , answers i've found aren't working. have html select follows:

<select name=x id=sel> <option value="1">1</option> <option value="2">3</option> <option value="3">3</option> </select>

i read actual value database using ajax phone call , execute line:

$("#sel").val(result);

the screen still shows 1 selected. have verified before line result equal 2.

i know i've seen somewhere, can't remember where.

you need refresh jqm selectmenu widget after changing value:

$("#sel").val(2).selectmenu("refresh");

demo

javascript jquery jquery-mobile

No comments:

Post a Comment