+ 4
how when a user enters input at least 4 characters the button will be active using javascript / jquery
10 Answers
+ 1
https://code.sololearn.com/Wyw1KDeuXAKU
+ 5
Kartik Krishnan thanks toođ
+ 4
that is to say, give me an example
+ 4
Sarbudeen thanksđ
+ 3
I mean the button is disabled when the user enters a minimum of 4 characters, the button changes to active
+ 3
Sarbudeen see my code the button is still disabled
+ 1
<input type="text" minlength="4" required>
+ 1
<input type="text" id="name" required>
<input type="submit" id="button">
<script>
$("#name").keyup(function (){
var len=this.val().length;
$("#button").attr("disabled",true);
if (len>=4){
$("#button").attr ("disabled",false);
}
else {
$("#button").attr ("disabled",true);
}
});
</script>
+ 1
Check the current update
+ 1
See this
https://code.sololearn.com/WDYr1r9T8Y3f/?ref=app
Pure Javascript...