jeudi 26 mars 2015

Hide Submit Button on Success Message

Please can some one point me in the right direction with this code.


When my form has been submitted a message is displayed however at the moment the Submit Button is still present.


I want to remove/hide the submit button once the form has been successfully submitted and the Success Message is being displayed.


I have looked around for answers on stack-overflow but so far everything I have tried has not worked.


Im sure I need to add something like this:



$('#sky-form button[type="submit"]').hide();


However I think maybe there is something already in the code that is stopping this from happening.


Here is my submit and message part of my form:



<button type="submit" button class="border-button">NEXT</button>
<div class="message">
<i class="fa fa-check"></i>
<p>Thanks for your order!<br>We'll contact you very soon.</p>
</form>


And here is the ajax:



submitHandler: function(form)
{
$(form).ajaxSubmit(
{
beforeSend: function()
{
$('#sky-form button[type="submit"]').addClass('button-uploading').attr('disabled', true);},
uploadProgress: function(event, position, total, percentComplete)
{
$("#sky-form .progress").text(percentComplete + '%');
},
success: function()
{
$("#sky-form").addClass('submited');
$('#sky-form button[type="submit"]').removeClass('button-uploading').attr('disabled', false);
}
});
},


Thanks so much to anyone that can help with this.


Aucun commentaire:

Enregistrer un commentaire