I am experiencing trouble as I want to make checkbox value checked when site loads and the visitor can uncheck it. id field is dynamic inside input so I need to check based on name and value I suppose.
I used jQuery to make it checked, but nothing happens
jQuery(document).ready(function($) {
$("input.myclass[name='test-case'][value='yes']").prop("checked", true);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="checkbox" name="test-case[]" id="cbopt-AAljenwo" value="yes">
Not sure if this is correct value of marking input as checked. User also can uncheck box if he doesn't like the option. Any help appreciated.
checked="checked"in HTMLcheckedattribute to the checkboxid field is dynamic inside input so I need to check based on name and value