I'm having a set of inputs where I can add or remove them in any number > 1. I need always one and any of this field to be required. But I don't know how to achieve this in the most effective way. For now my first field is required and when I add the copy of it to the list I just removed the required
attribute:
var newInput = $(previousInput)
.clone(true)
.attr('id', '--id_' + cloneCount)
.removeAttr('required');
newInput.appendTo($(div));
but each of these fields may be removed by corresponding remove_button
. So when the input with required
attribute there will be none left. What's more then every time the same field would have to be filled in while I would like to any if these be enough. What is the proper way to achieve this?