I have my dynamic table with table cell where I created chekbox input. That check box switch the text available and blocked depends if it's checked or not. Now I would like to add div with id that will show up each time when I click on the check box. Problem is if I click on the check box now, my div will show up just on the first row, not on the row where I clicked on. Here is my code:
<tr class="blockRow">
<td>
<cfif qryTable.UserID EQ 0>
<label>
<input type="checkbox" name="stop" id="stop" onChange="updateTable('#TimeID#')" checked>
<span>Blocked</span>
</label>
</cfif>
<cfif qryTable.UserID EQ -1>
<label>
<input type="checkbox" name="stop" id="stop" onChange="updateTable('#TimeID#')">
<span>Available</span>
</label>
</cfif>
<div id="message"></div>
</td>
</tr>
Here is my JQuery:
$('input[type=checkbox]').on('change', function() {
$('label').on('change', function() {
var checked = $('input', this).is(':checked');
$('span', this).text(checked ? 'Blocked' : 'Available');
});
});
How I can include my div on the bottom with id=message to show up each time after I click on the check box? If anyone can help please let me know.
Aucun commentaire:
Enregistrer un commentaire