我正在尝试从代码创建翻转切换。
var favFlip = '<label for="favourFlip">To fav:</label>'+
'<select id="favourFlip" data-role="slider">'+
'<option value="off">Off</option>'+
'<option value="on">On</option>'+
'</select>';
$('.ui-content').append(favFlip);
var flip = $('#favourFlip');
flip.slider('refresh');
此代码在pagebeforeshow
处理程序中工作并抛出错误:Uncaught cannot call methods on slider prior to initialization; attempted to call method 'refresh'
。怎么修?