jquery select all checkboxes
I have a series of checkboxes that are loaded 100 at a time via ajax.

I need this jquery to allow me to have a button when pushed check all on screen. If more are loaded, and the button is pressed, to perhaps toggle all off, then pressed again toggle all back on.

This is what i have, obviously its not working for me.

    $(function () {
    	$('#selectall').click(function () {
    		$('#friendslist').find(':checkbox').attr('checked', this.checked);
    	});
    });

The button is `#selectall`, the check boxes are class `.tf`, and they all reside in a parent div called `#friendslist`
jquery select all checkboxes
===

I have a series of checkboxes that are loaded 100 at a time via ajax.

I need this jquery to allow me to have a button when pushed check all on screen. If more are loaded, and the button is pressed, to perhaps toggle all off, then pressed again toggle all back on.

This is what i have, obviously its not working for me.

    $(function () {
    	$('#selectall').click(function () {
    		$('#friendslist').find(':checkbox').attr('checked', this.checked);
    	});
    });

The button is `#selectall`, the check boxes are class `.tf`, and they all reside in a parent div called `#friendslist`