由于我对jQuery mobile的了解很少,因此我面临一个非常具有挑战性的问题。我研究了许多解决方案并实施了它们,但似乎没有用
click me
disabled
,文本clickme
更改为please wait...
disabled
),并且文本从please wait...
返回变为click me
。$(this).parent('').text('Please wait...');
地工作,但是可以建议我如何使它与一起工作please wait...
。任何帮助或指导将不胜感激。我的代码如下:
<div class="ui-btn ui-input-btn ui-corner-all ui-shadow">
clickme
<input class="submit button-primary btn large send" id="wp-submit" name="up_submit" tabindex="250" type="button" value="clickme">
</div>
$(document).ready(function () {
var clicked = false;
$('#wp-submit').bind('click', function() {
if(clicked == false) {
$(this).button('disable');
$(this).parent('').text('Please wait...');
clicked = true;
setTimeout(function() {
$('#wp-submit').button('enable');
$(this).parent('').text('click me');
clicked = false;
}, 2000);
}
});
});
非常感谢@ezanker在这里解决了这个问题->使用setTimeout函数更改jQuery mobile的按钮值
回答:
$(document).ready(function () {
var clicked = false;
$('#wp-submit').on('click', function() {
if(clicked == false) {
var $btn = $(this);
$btn.button('disable').val('Please wait...').button('refresh');
clicked = true;
setTimeout(function() {
$btn.button('enable').val('click me').button('refresh');
clicked = false;
}, 2000);
}
});
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句