I have one form and a pair of divs with a bunch of input fields and one select box that shows one div and hides all the others. This input field has the html5 required tag. I would like to remove the required tag from all input fields that are in hidden divs. How can i do this? Here is my js for showing / hiding divs depending on my selection options:
<script>
function changeGroup(e) {
$("#main")
.removeClass(allGroups)
.addClass($("option:selected", e.target).val())
}
var allGroups = $("select")
.change(changeGroup)
.find("option")
.map(function() {
return $(this).val();
})
.get()
.join(' ');
</script>
Thanks for the help ... Dorijan
source
share