jQuery - Targeting specific ID's

Posted by Cecil on Stack Overflow See other posts from Stack Overflow or by Cecil
Published on 2011-01-15T08:48:12Z Indexed on 2011/01/15 8:53 UTC
Read the original article Hit count: 176

Filed under:

Hey All,

I have the following code:

<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("input:checkbox").click(function(){
    var group = "input:checkbox[name='"+$(this).attr("name")+"']";
    $(group).attr("checked",false);
    $(this).attr("checked",true);
});
});
</script>                               

How do i get it to target a specific ID rather than every checkbox on the page?

i.e if the group of checkboxes im trying to target is #thisgroup

Cheers,

© Stack Overflow or respective owner

Related posts about jQuery