Answer the question
In order to leave comments, you need to log in
How to implement so that when you enter 2 digits in the input, the button changes color?
How to implement so that when you enter 2 digits in the input, the button changes color.
Answer the question
In order to leave comments, you need to log in
<form id="theForm" class="pure-form pure-form-stacked">
<div>
<label for="radius">Radius</label>
<input type="text" name="radius" id="radius"/>
<input type="submit" id="submit" value="Calculate" class="button-secondary pure-button"/>
</div>
</form>
$('#radius').keypress(function() {
var dInput = this.value;
console.log(dInput.length);
if (dInput.length >= 1) {
if (!isNaN(dInput)) {
$('input[type=submit]').addClass("button-error");
}
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question