Ok I realise this might not be a pure SharePoint question, but I have tried several "normal" solutions for this without any succesfull outcome - so I'm kinda hoping there some SharePoint "magic" going on that somebidy might know of.
In SharePoint Online I have a form which includes a chechbox. I want to know - using jquery - if the checkbox is in fact checked or not.
I very much would like to get the element by it's ID as opposed to the name/title/etc. and realising SharePoint adds a random string to the ID, I'm forced to use some form of 'begins with' (Which is fine for this purpose).
I have tried several versions of $("input[id^=" + TravelTypeId + "]") (Where 'TravelTypeId' is the starting part of the Id of the checkbox). For instance.val() and .prop("checked") does not seem to work at all returning 'undifined'. Then I tried .is(":checked") which does return a boolean, it's just always 'false'.
What am I overlooking here?
Added for clarification:
The input is placed in a span element. Which is placed in a normalt table :)

var travelTypeInput = $('input[id*="+ TravelTypeId +"]'); console.log($(travelTypeInput).is(':checked'))