[jQuery] Re: count checkboxes selected

2009-08-07 Thread James
Usually checkboxes should have different names for its attributes, and add class="chkLimit". "input.chkLimit" means an input element with class "chkLimit" Otherwise, for your code, you can try to use: "input[id^=chkLimit_]" if you want. This means all inputs with id that begins with "chkLimit_".

[jQuery] Re: count checkboxes selected

2009-08-07 Thread ripcurlksm
Thanks James, that was really helpful -- I've placed the code, but I can not get it to populate the . Did I place it in the correct area? http://psylicyde.com/misc/checkbox -- View this message in context: http://www.nabble.com/count-checkboxes-selected-tp24871849s27240p24872962.html Sent fro

[jQuery] Re: count checkboxes selected

2009-08-07 Thread James
It was an example to show you how to get the number of selected checkbox... If you want to integrate it with events, then you might want to do something like: $("input.myCheckbox").click(function() { var numSelected = $("input.myCheckbox:checked").length; var numLeft = 10 - parseInt(numS

[jQuery] Re: count checkboxes selected

2009-08-07 Thread ripcurlksm
I dont want to use an alert, I want to use ajax or some method to show how many checkboxes are selected in REAL TIME. So when you select one checkbox it says on the page: You have 1 CD's selected. You have 9 selections left. When you select a second checkbox it says on the page: You have 2

[jQuery] Re: count checkboxes selected

2009-08-07 Thread James
Suppose all your checkbox has the class "myCheckbox": var numSelected = $("input.myCheckbox:checked").length; alert(numSelected); You can use simple math to get how many are remaining. On Aug 7, 10:53 am, ripcurlksm wrote: > I have a script where a user can select any 10 out of 20 CD's. I am u