Loop required form inputs
I'm trying to loop through all inputs in a form that have type of text. Below is typ. html:
- <form class="cd-form floating-labels">
- <fieldset>
- <div class="icon">
- <label class="cd-label" for="cd-name">Name</label>
- <input class="user" type="text" name="cd-name" id="cd-name" required>
- </div>
- </fieldset>
- </form>
I keep getting error on each - is not a function & is not defined:
- $('form.cd-form input[type=text]').prop('required').each(function() {
- if ($(this).val() == '') {
- ... handle no input
- }
- });
What am I doing wrong?
Thanks, Bill