This code doesn't run the else if part at all even though i did console.log and it recognizes 0 length too. It still won't show the string. It will give the first parth though. What is the problem?
function check_width() {
var width= $('#plwidth').val();
if (width< 20 || width> 200) {
$('#error_width').html("Annettu luku ei kelpaa");
$('#error_width').show();
} else if (width.length === 0) {
$('#error_width').html("Täytä kenttä");
$('#error_width').show();
} else {
$('#error_leveys').hide();
}
}
Aucun commentaire:
Enregistrer un commentaire