I've seen many examples on setting tabindex for checkboxes but I haven't been able to find examples of getting the currently selected checkbox’s tabindex or its position in a group. I’ve been trying to make the below code work but I get a value of 0 for each checked box. Can you please point me to an example or help me with this one? Thanks.
$.each($checkboxes, function () {
if ($(this).is(':checked')) {
var selectedIndex = $(this).attr('tabindex');
//do something with selectedIndex
EDIT
so jesh.tesh I am trying to use your code in this line var theCheckboxPosition = ($(this).prop("tabindex")); but it ignores the eq(theCheckboxPosition). Here's what I should've posted to begin with.
var $checkboxes = $('input[type="checkbox"]');
$(document).ready(function () {
var nos = $('#listTable #searchString').length;
// alert(nos);
$.each($checkboxes, function (idx, data) {
if ($(this).is(':checked')) {
// alert('checked');
var theCheckboxPosition = ($(this).prop("tabindex"));
$('#listTable .teacherlists').eq(theCheckboxPosition).css('border', '2px dashed blue');
$('#listTable .daylists').eq(theCheckboxPosition).css('border', '2px dashed blue');
}
});
});
</script>