unable to set values of select tag in jquery mobile -



unable to set values of select tag in jquery mobile -

i had created select tag in html(selecttest.html) values.what i'm trying after selecting value select tag, need page refreshed , pass selected alternative parameter url.

then need set selected value 1 time page refreshed. i'm not sure whether problem related jquery mobile.

<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ var param = window.location.search; if(param) { var indx = param.indexof("="); //now value of selected type aval =param.substring(indx+1); $("#lang").val(aval); } $("#lang").change(function(){ var sel = $(this).val(); window.location.href="selecttest.html?type="+sel; }); }); </script> <title>insert title here</title> </head> <body> <div data-role="page" id="home" data-theme="e"> <div data-role="header"> <h1>test</h1> </div> <div data-role="content" id="toi"> <div> <label for="lang">select language</label> <select name="language" id="lang"> <option value="en">english</option> <option value="hi">hindi</option> <option value="sp">spanish</option> <option value="fr">french</option> </select> </div> <div id="main"> </div> </div> </div> <div data-role="footer"> <h4>test</h4> </div> </div> </body> </html>

from jquery mobile docs:

if manipulate select via javascript, must phone call refresh method on update visual styling. here example:

var myselect = $("select#foo"); myselect[0].selectedindex = 3; myselect.selectmenu("refresh");

so need phone call refresh on it. help?

for code can chain this

$('#lang').val(aval).selectmenu("refresh");

jquery jquery-mobile

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -