jquery mobile界面數(shù)據(jù)刷新的實(shí)現(xiàn)方法
JQM里面當(dāng)我們更新了某些頁面標(biāo)簽(如: listview, radiobuttons, checkboxes, select menus)里的數(shù)據(jù)時,必須做refresh操作.
為什么必須做refresh操作操作呢?因?yàn)镴QM在做頁面渲染的時候,為了使樣式跟客戶端程序相似, 隱藏了原始的標(biāo)簽然后用一些新的標(biāo)簽和自定義的樣式來表現(xiàn)原標(biāo)簽,其實(shí)新樣式的標(biāo)簽已經(jīng)不是原來的標(biāo)簽,所以更新了數(shù)據(jù)必須做refresh操作.
各類標(biāo)簽的刷新
1.Textarea fields
$('body').prepend('<textarea id="myTextArea"></textarea>'); $('#myTextArea').textinput();
2.Text input fields
$('body').prepend('<input type="text" id="myTextField" />'); $('#myTextField').textinput();
3.Buttons
$('body').append('<a href="" data-theme="e" id="myNewButton">testing</a>'); $('#myNewButton').button();
4.Combobox or select dropdowns
<label for="sCountry">Country:</label> <select name="sCountry" id="sCountry"> <option value="">Where You Live:</option> <option value="ad">Andorra</option> <option value="ae">United Arab Emirates</option> </select> var myselect = $("#sCountry"); myselect[0].selectedIndex = 3; myselect.selectmenu('refresh');
5.Listviews
<ul id="myList" data-role="listview" data-inset="true"> <li>Acura</li> <li>Audi</li> <li>BMW</li> </ul> $('#mylist').listview('refresh');
6.Slider control
<div data-role="fieldcontain"> <label for="slider-2">Input slider:</label> <input type="range" id="slider-2" value="25" min="0" max="100" /> </div> $('#slider-2').val(80).slider('refresh');
7.Toggle switch
<div data-role="fieldcontain"> <label for="toggle">Flip switch:</label> <select name="toggle" id="toggle" data-role="slider"> <option value="off">Off</option> <option value="on">On</option> </select> </div> var myswitch = $("#toggle"); myswitch[0].selectedIndex = 1; myswitch .slider("refresh");
8.Radio buttons
<div data-role="fieldcontain"> <fieldset data-role="controlgroup" data-type="horizontal"> <legend>Layout view:</legend> <input type="radio" name="radio-view" value="list" /> <label for="radio-view-a">List</label> <input type="radio" name="radio-view" value="grid" /> <label for="radio-view-b">Grid</label> <input type="radio" name="radio-view" value="gallery" /> <label for="radio-view-c">Gallery</label> </fieldset> </div> $("input[value=grid]").attr('checked',true).checkboxradio('refresh');
9.Checkboxes
<div data-role="fieldcontain"> <fieldset data-role="controlgroup"> <legend>Agree to the terms:</legend> <input type="checkbox" name="checkbox-1" id="checkbox-1" class="custom" /> <label for="checkbox-1">I agree</label> </fieldset> </div> $('#checkbox-1').attr('checked',true).checkboxradio('refresh');
以上這篇jquery mobile界面數(shù)據(jù)刷新的實(shí)現(xiàn)方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
JQuery實(shí)現(xiàn)簡單驗(yàn)證碼提示解決方案
驗(yàn)證碼提示功能在ui界面的登陸及提交窗口中起到了一定的有好作用,極大的提高了用戶體驗(yàn),本文帶著這個美好的祝愿為您實(shí)現(xiàn)簡單驗(yàn)證碼提示,需要的朋友可以了解下2012-12-12基于jQuery和CSS3制作數(shù)字時鐘附源碼下載(jquery篇)
本篇文章基于jquery讓數(shù)字時鐘真正的跑起來,實(shí)現(xiàn)一個帶有日期和星期的網(wǎng)頁版數(shù)字時鐘,效果非常逼真,感興趣的朋友一起看看吧2015-11-11jQuery+ajax實(shí)現(xiàn)動態(tài)執(zhí)行腳本的方法
這篇文章主要介紹了jQuery+ajax實(shí)現(xiàn)動態(tài)執(zhí)行腳本的方法,分析了jQuery+Ajax實(shí)現(xiàn)腳本的動態(tài)加載與執(zhí)行的技巧,需要的朋友可以參考下2015-01-01使用jQuery加載html頁面到指定的div實(shí)現(xiàn)方法
下面小編就為大家?guī)硪黄褂胘Query加載html頁面到指定的div實(shí)現(xiàn)方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-07-07jQuery 打造動態(tài)下滑菜單實(shí)現(xiàn)說明
本教程將分步講解如何使用JQuery和CSS打造一個炫酷動感菜單。2010-04-04jQuery實(shí)現(xiàn)點(diǎn)擊按鈕彈出可拖拽模態(tài)對話框完整實(shí)例【測試可用】
這篇文章主要介紹了jQuery實(shí)現(xiàn)點(diǎn)擊按鈕彈出可拖拽模態(tài)對話框的方法,結(jié)合完整實(shí)例形式分析了jQuery調(diào)用模態(tài)對話框的基本原理、實(shí)現(xiàn)方法與相關(guān)操作技巧,需要的朋友可以參考下2023-04-04