This will get you the attribute value
$('#row').attr('recordID');
If you wanted to get the value when the checkbox gets checked, here is an example
js file
$(document).ready(function(){
$('input:checkbox').change(function(){
if($(this).attr('checked')){
alert($(this).parent().attr('recordID'));
}
});
});
To see how many rows have been checked:
JavaScript
$(document).ready(function(){
$('#check').click(function(event){
event.preventDefault();
alert($('input:checkbox:checked').size());
});
});
HTML
<span id="row1" recordID="1">
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
</span>
<span id="row2" recordID="2">
<input type="checkbox" style="left:10;" />
</span>
<span id="row3" recordID="3">
<input type="checkbox" style="left:10;" />
</span>
<span id="row4" recordID="4">
<input type="checkbox" style="left:10;" />
</span>
<button id='check'>Check Num Rows</button>
To check within an individual span
$(document).ready(function(){
$('#check').click(function(event){
event.preventDefault();
alert($('#row1 input:checkbox:checked').size());
});
});
Here is the complete sample code i am using to make the example you need
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type='text/javascript'>
$(document).ready(function(){
$('input:checkbox').change(function(){
alert($(this).parent().find(':checkbox:checked').size());
});
});
</script>
</head>
<body>
<span id="row1" recordID="1">
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
</span><br/><br/>
<span id="row2" recordID="2">
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
</span><br/><br/>
<span id="row3" recordID="3">
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
</span><br/><br/>
<span id="row4" recordID="4">
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
<input type="checkbox" style="left:10;" />
</span>
</body>
</html>