jquery mobile界面数据刷新的实现方法

前端之家收集整理的这篇文章主要介绍了jquery mobile界面数据刷新的实现方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

JQM里面当我们更新了某些页面标签(如:listview,radiobuttons,checkBoxes,selectmenus)里的数据时,必须做refresh操作.

为什么必须做refresh操作操作呢?因为JQM在做页面渲染的时候,为了使样式跟客户端程序相似,隐藏了原始的标签然后用一些新的标签自定义的样式来表现原标签,其实新样式的标签已经不是原来的标签,所以更新了数据必须做refresh操作.

各类标签的刷新

1.Textareafields

'); $('#myTextArea').textinput();

2.Text input fields

'); $('#myTextField').textinput();

3.Buttons

'); $('#myNewButton').button();

4.ComboBoxorselectdropdowns

<div class="jb51code">
<pre class="brush:js;">
<label for="sCountry">Country:
<select name="sCountry" id="sCountry">
<option value="">Where You Live:
<option value="ad">Andorra
<option value="ae">United Arab Emirates

var myselect = $("#sCountry");
myselect[0].selectedIndex = 3;
myselect.selectmenu('refresh');

5.Listviews

<div class="jb51code">
<pre class="brush:js;">
<ul id="myList" data-role="listview" data-inset="true">
@H_30138@Acura
@H
30138@Audi
@H
301_38@BMW

$('#mylist').listview('refresh');

6.Slidercontrol

<div class="jb51code">
<pre class="brush:js;">
<div data-role="fieldcontain">
<label for="slider-2">Input slider:

$('#slider-2').val(80).slider('refresh');

7.Toggleswitch

var myswitch = $("#toggle");
myswitch[0].selectedIndex = 1;
myswitch .slider("refresh");

8.Radiobuttons

Layout view: @H_404_76@

$("input[value=grid]").attr('checked',true).checkBoxradio('refresh');

9.CheckBoxes

Agree to the terms: @H_404_76@

$('#checkBox-1').attr('checked',true).checkBoxradio('refresh');

以上这篇jquery mobile界面数据刷新的实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。

原文链接:https://www.f2er.com/jquery/48378.html
jquerymobile刷新刷新刷新

猜你在找的jQuery相关文章