Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
KnowledgeWoods Consulting
5,607 PointsDisable the checkbox that was checked last
I have few checkboxes. Each checkboxes has numerical value. What i am trying to do here is that clicking on checkboxes a div shows the sum of values of checked checkboxes. Now i want that when the sum is greater than 44 the checkbox which was checked last gets uncheck. You cannot check the checkbox which makes sum greater than 44. How can i do that?
1 Answer
Presley Cobb
9,214 PointsI imagine you would need to run a function at the time of clicking the check box. That function would add to a variable you have set to zero. Wrap that function in an if statement that only runs the if statement if the number is less that 44. Else grey out all the other boxes. Im feeling too lazy to right now the logic right now XD.
sizwengubane
15,244 Pointssizwengubane
15,244 Pointsplease show me ur html and the javascript coding u have done so far