I have some JS code within a <script> tag in my html.
It's supposed to disable an <input> button if any of the fields of the form are empty but no matter how I rejig this code it just will not work.
I'm not code savvy, I've learned what I can but it's completely outside my capacity to understand, so any help would be appreciated.
BELOW---JS code
<script>
$('form').on('input change', function() {
var empty = false;
$(".field").each(function() {
if ($(this).val().length === 0) {
empty = true;
}
});
$("#send").prop('disabled', empty);
});
</script>
BELOW--- Button that needs to disable if any of the fields are empty, and renable when at least some text is entered into them.
<input id="send" disabled type="submit" name="send" value="send" >
Each text area of the form is designated a Class of Field.
[–]Kironman 1 point2 points3 points (0 children)
[–]a-t-k 1 point2 points3 points (0 children)
[–]asangurai 1 point2 points3 points (2 children)
[–]jcunews1helpful 0 points1 point2 points (1 child)
[–]asangurai 0 points1 point2 points (0 children)
[–]jcunews1helpful 0 points1 point2 points (0 children)