I have some checkBoxes and as long as one of them is ticked, the submit button should be enabled.
However, I do not get the Javascript function right.
In the beginning, the submit button is always disabled, when I tick on checkBox it gets enabled and remains enabled for all the time.
Here is my code:
<td><input type="checkbox" name="searchValues" th:value="${user.id}" th:checked="${user.isActive}" th:onclick="${'inputClick('''+ itemStat.index +''')'}" /></td>
The Javascript function
<script>
$(function(){
$("input[type='checkBox']").change(function(){
$("input[type='submit']").prop("disabled", false);
});
});
</script>
The submit button
<input type="submit" id="submitButton" th:value="Speichern" name="submit" disabled="disabled"/>
It could be that when loading the site that some checkBoxes are already ticked, so the submit button should be enabled, too. Only when nothing is ticked, the submit button should be disabled.
Maybe someone knows what I am missing here?