I'm implementing the Mailgun jQuery email validator. I'm trying to get the submit button on my form to change it's input upon a successful verification. Right now, when I put this replaceWidth code in the validation_error function, nothing happens, even on an error message. However, when I put it in the validation_success function, it triggers with either an error or success. Is there a reason it would work in one function and not the other?
function validation_success(data) {
$('#status').html(get_suggestion_str(data['is_valid'], data['did_you_mean']));
$('.signupbtn_new').replaceWith('<input type="submit" name="submit" class="signupbtn_new" value="Signup For Free!" id="email_submit">');
}
// if email is invalid
function validation_error(error_message) {
$('#status').html(error_message);
}