Jquery Mobile中组件内容更新后的刷新办法

Jquery Mobile中组件内容更新后需要调用刷新方法,否则内容不会变化(比如 span select button等)
总结了一下,常用的组件对应的刷新方法如下:

1Combobox or select dropdowns 
var myselect = $("#sCountry");
 myselect[0].selectedIndex = 3;
 myselect.selectmenu('refresh');
or
$( ".selector" ).selectmenu( "refresh", true );

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

3Slider control 
$('#slider').val(80).slider('refresh');

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

5Radio buttons 
$("input[value=grid]").attr('checked',true).checkboxradio('refresh');
or
$( ".selector" ).prop( "checked", true ).checkboxradio( "refresh" );

6Checkboxes 
$('#checkbox-1').attr('checked',true).checkboxradio('refresh');
or
$( ".selector" ).prop( "checked", true ).checkboxradio( "refresh" );

7Buttons 
$( "[type='submit']" ).button( "refresh" );
or
$( ".selector" ).buttonMarkup( "refresh" );

8Column-Toggle Table 
$( ".selector" ).table-columntoggle( "refresh" );

9Reflow Table 
$( ".selector" ).table( "refresh" );

10Span等
var c = "";
c="还剩:<span>00</span>天<span>00</span>小时<span>00</span>分<span>00</span>秒";
$("#p_time").html(c).trigger("create");  

你可能感兴趣的:(Jquery Mobile中组件内容更新后的刷新办法)