I'm doing some changes on my website and I have made my form with the select box. Before select, I was using input fields but now I changed them to select because this fields are reading values from my database.
So now I'm trying to mark these select fields as required but can't figure out how to do it.
This is my code for the input fields with required flag true, but now how to do the same for the select fields.
jQuery(".next").click(function () {
var filter = true,
reded = [];
jQuery(".visible-path input").filter("[required]").each(function () {
if (jQuery(this).val() === '') {
jQuery(this).css("border", "1px solid red");
reded.push(jQuery(this).index("input"));
filter = false;
}
});
setTimeout(function () {
for (var i = 0; i < reded.length; i++) {
jQuery("input").eq(reded[i]).css("border", "1px solid #e7e7e7");
jQuery("select").eq(reded[i]).css("border", "1px solid #e7e7e7");
}
reded = [];
}, 800);