I have a checkbox. I am trying to use the example from another SO question to figure out if it is selected or not.
However, I only seem to be able to query the state of the element using document.getElementById. I would like to get it working as per the Stack Overflow example. Code below...
<html>
<br>
                <label>Select All BOM's</label>
                <input type="checkbox" id="allboms" name="degbutton"/>
<br>
function doSomething()
    {
        //does not work
        if ($("#allboms").checked){
            //Do stuff
            alert('was checked');
        }
        //does not work
        if ($("#allboms").attr("checked")) {
            //Do stuff
            console.log("boooooooooooo");
            alert('i1 was checked');
        }
        //works
        if(document.getElementById("allboms").checked){
            //Do stuff
            alert('is checked ');
       }else{
            alert('is unchecked .....');
       }
</html>
 
     
     
    