So there is a ASP checkboxlist that gets rendered to the table and in the code behind the checkboxes get bound with a label from a code table. I need to display a text box only if a certain checkbox is checked off.
<table id="chkSomeCheckbox">
<tbody>
<tr>
<td>
<input type="checkbox" id="chkSomeCheckbox_0">
<label for="chkSomeCheckbox_0">Acme</label>
</td>
<td>
<input type="checkbox" id="chkSomeCheckbox_1">
<label for="chkSomeCheckbox_1">Other</label>
</td>
</tr>
</tr>
</tbody>
</table>
The checkboxlist renders a table which the element retains the ID. I have tried to just get the value of the label when a checkbox is checked and then go from there to create my logic - but I can't seem to be able to grab the value of the label. I have tried the following different ways:
$("#<%chkSomeCheckbox.ClientID> input").next("label").val();
or
$("#<%chkSomeCheckbox.ClientID> input").next().val();
I am using the input selector because when I get this first part working, I will need to do some logic on it.
Any thoughts?