Get checkbox selected state with JQuery
<p>I tried many ways to get the selected state of a checkbox. Its a input field with type checkbox. </p>

<p>I tried the following methods to get the state, but all returns <code>false</code>. Only if the checkbox was set selected/not selected with jQuery before (this was done with <code>$.prop("checked", "true")</code>.</p>

<pre><code>$("#ID").prop("checked");
$("#ID").val(); //returns "on" everytime
$("#ID").attr("checked");
$("#ID").checked; //undefined
</code></pre>

<p>ID is a real id in my Code!</p>

<p>The selected state is also set with jQuery like this:</p>

<pre><code>$(columns[i]).children().first().prop("checked", stateArray[i]);
</code></pre>

<p>The checkboxes are in a KendoGrid and columns.children gets all <code>td</code>'s and <code>first()</code> returns the input.</p>

<p><code>stateArray</code> is an array with true/false.</p>

<p>Nothing works... Do you got an idea?</p>

<p>Regards</p>

<p>EDIT: I found the fault... the ID generated for the inputs was always the same... so it selected the first element which was not selected... I'm sorry for that!</p>