1
I’m having trouble counting the checkboxes that are selected, maybe for the following reason, I have a radio that is also selected. Whenever I use the code $('input[type="checkbox"]:checked').length
1 is displayed, and no checkbox is selected. If I select only one, 2 is displayed and so on. How to solve this problem?
Give a
console.log($('input[type="checkbox"]:checked'))
check which checkbox are listed, make sure there are no hidden.– KaduAmaral
It looks good here: http://jsfiddle.net/t9t5cz86/ you can adapt jsFiddle with your code to see if we find the problem?
– Sergio
@Kaduamaral did this, and look what appeared: http://postimg.org/image/mdx7uqo1f/. Nowhere have I found this code.
– Leomar de Souza
@Sergio my code is like this: I have two radio with the options PUBLIC and PRIVATE. If the user clicks PRIVATE, my application (in Asp.net mvc) searches for a list of SECTORS and I display the sectors on the screen for the user to select. I’ll try to put the code in the url for you to see
– Leomar de Souza
@Zackmorgan do you use any framework? This checkbox has something to do with menu. The cause of the "being an extra" number is because of this checkbox, there is nothing wrong with your code. Either you have to remove it or use another logic.
– KaduAmaral
@Kaduamaral use several, for css, javascript. This application is being developed in Asp.net mvc. I will perform a test with all frameworks in the project.
– Leomar de Souza