How to preselect and disable specific checkboxes using js/jquery?
I have checkboxes with randomly generated ids on every page view and want to preselect and disable some of them, so they can not get unchecked anymore.
With a simple script which looks after
value="" I’m able to achieve the preselection but if I try to disable it at the same time, it disables all input fields on the page.
I think it is smarter to get the randomly generated ids of the specific checkboxes using my method mentioned above and then put them in a function. But this is where I fail!
What would be your solution if we had this and couldn’t select by id:
<input type="checkbox" id"?" value="check1"> <input type="checkbox" id"?" value="check2"> <input type="checkbox" id"?" value="check3">
I would appreciate any help.