简体   繁体   中英

Validate empty value for dynamic HTML Select with unknown id and common class

currently i have a form with dynamically generated select input.

Field name is an array in the form name="myfield[]" and they have a common class, example: class="unknownfield"

How can i, using Javascript or jQuery validate that every select on the Form has a selected which is not the default empty?

Something to the extent of:

$("form select").each(function() {
    if (this.value == "") //empty!

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM