Tell me how to implement so that the "send" button is blocked until the necessary word is entered into the text field I need?
- one@vinnie - everything on the client can be bypassed. - zb '
- 3in html5 there is an attribute required jsfiddle.net/oceog/EHStf - zb '
- 3> field validation is not necessary. Re-read your question, however. Or you have some kind of your own understanding of the word "validation". In any case, I propose to solve the inverse problem: unlock the button as soon as the desired value appears in the desired field. In this setting, it is clear what to do? - user6550
- oneMaybe he just needs [this] [1]? [1]: w3schools.com/tags/tryit.asp?filename=tryhtml_button_disabled - Bars
- 2If @Bars is right, then on css you can do something like this - zb '28
|
1 answer
For example, if entered more than 10 characters in the field. Based on the example, further, you will understand.
$("#text").on('input', function(e) { if (e.target.value.length > 10) { $('#btn').attr('disabled', false); } } );
<input type="submit" disabled value="Кнопка" id="btn"> <input type="text" id="text">
- oneJQuery was not mentioned in the question. - LEQADA
|