Tengo una forma sencilla de comprobar el valor de código postal introducido por el usuario frente a una variable,cómo deshabilitar botón de enviar con jQuery
Estoy tratando de desactivar el botón de enviar y hacer el cheque y dar alerta mensaje, no puedo entender lo que estoy haciendo mal, cualquier ayuda sería apreciada.
<form id="post_code">
<input name="textfield" type="text" id="postcode" size="14" maxlength="8" />
<input type="image" id="submit_postcode" src="images/B_go.png" alt="Submit Postcode" width="59" height="24" border="0" />
</form>
$(function() {
$('form#post_code').submit(function() {
var entered_post_code = $('form#post_code input#postcode').val();
var post_code = "CV";
if (entered_post_code == post_code) {
alert("post code is ok");
return true;
}else {
alert("post code is not ok");
return true;
}
return false;
});
});
http://stackoverflow.com/questions/1594952/jquery-disable-enable-submit-button –