I am facing a very challenging problem due to my little knowledge in jQuery mobile. I have researched many solutions and implemented them but does not seem to work
- I have a button called
click me
- When a user clicks on the button, the button becomes
disabled
and the textclickme
changes toplease wait...
- After 2 seconds the button become activated (no longer
disabled
) and the text changes fromplease wait...
back toclick me
. - I have gotten it to work to some extent. The code works pefectly with out this code line
$(this).parent('').text('Please wait...');
but could one kindly advise how i get it to work with aplease wait...
.
Any help or guidance will be much appreciated. My code is below:
<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);
}
});
});