sphinx Posted December 4, 2010 Share Posted December 4, 2010 Hello, My current login button consists of: <form method="post" action=""> <input type="password" name="pswd"> <input type="submit" onclick="this.disabled=true;return true;" name="login" value="Login"> Basicly, I want to achieve the following: 1: Submit in 5 seconds when clicked, not instantly. 2: Change the text on the button when clicked ie: Please wait.. 3: Disable button once clicked, like I have already done. Is this possible to fit into one? Thanks Link to comment https://forums.phpfreaks.com/topic/220669-javascript-help-with-html-button/ Share on other sites More sharing options...
Lautarox Posted December 5, 2010 Share Posted December 5, 2010 You need to make a function that will be called when the button is clicked, for the 5 seconds you need to be waited, you can check here http://www.sean.co.uk/a/webdesign/javascriptdelay.shtm, for the button name, you can change it using the .value property and for disabling the button you can check here http://www.codetoad.com/javascript/enable_disable_form_element.asp, I recommend you to read about javascript. Link to comment https://forums.phpfreaks.com/topic/220669-javascript-help-with-html-button/#findComment-1143263 Share on other sites More sharing options...
brianlange Posted December 5, 2010 Share Posted December 5, 2010 Try something like this $(document).ready(function() { $('#myForm').submit(function() { $('#submit').attr('value', 'Please Wait'); setTimeout(function (){ this.submit(); }, 5000); }); }); Link to comment https://forums.phpfreaks.com/topic/220669-javascript-help-with-html-button/#findComment-1143266 Share on other sites More sharing options...
Lautarox Posted December 5, 2010 Share Posted December 5, 2010 brianlange, I think that what he wants it's to perfom the form submission after 5 seconds of clicking a button, make clear that you are using jquery to not confuse sphinix. Link to comment https://forums.phpfreaks.com/topic/220669-javascript-help-with-html-button/#findComment-1143293 Share on other sites More sharing options...
sphinx Posted December 5, 2010 Author Share Posted December 5, 2010 jquery is a new thing to me you see Link to comment https://forums.phpfreaks.com/topic/220669-javascript-help-with-html-button/#findComment-1143327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.