Checkboxes keeping checked class after unchecking
See original GitHub issueAre you requesting a feature, reporting a bug or ask a question?
Reporting a bug
What is the current behavior?
When using checkboxes field, checking them will add a checked
class to the div
wrapping the label
. However, when you uncheck the last checkbox (leaving nothing checked), the last box to be unchecked will still have a checked
class applied to the div.
What is the expected behavior?
The checked
class should be removed from any checkbox that is not checked.
How would you reproduce the current behavior (if this is a bug)?
Create a survey with a checkboxes field, check a checkbox, then uncheck. checked
class will remain.
Provide the test code and the tested page URL (if applicable)
Tested page URL: https://codepen.io/benirose/pen/aGqVor
(You’ll have to inspect elements to see the checked
class still applied)
Specify your
- browser: Chrome
- browser version: 66
- surveyjs platform (angular or react or jquery or knockout or vue): Vue
- surveyjs version: 1.0.20
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
HTML checkboxes keep checked after refresh - Stack Overflow
If I refresh the page with Ctrl+Shift+R everything is OK - the page renders unchecked check boxes, however if some of them were...
Read more >Quick Tip: Persist Checkbox Checked State after Page Reload
This quick tip describes how to have your browser remember the state of checkboxes once a page has been refreshed or a user...
Read more >Check or Uncheck all in a group of checkbox in JavaScript
If we have a series or a group of check boxes then we can provide one button ... This way the user in...
Read more ><input type="checkbox"> - HTML: HyperText Markup Language
In this example we keep track of the ingredients we are collecting for a recipe. When you check or uncheck an ingredient's checkbox, ......
Read more >Indeterminate Checkboxes - CSS-Tricks
Checkbox inputs can only have two states: checked or unchecked. They can have any value, but they either submit that value (checked) or ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@benirose please look at #1097 we’ve fixed it here (https://github.com/surveyjs/surveyjs/commit/a0ee7d971615a790954f6f167c6a00362d7bf8f7).
Vue.delete
andVue.set
methods does the trick. And the docHello! This is not actually the bug. Survey data is hash table and Vue can’t correctly watch it out of the box. We need to create separate observable variable for it. Please check: https://codepen.io/dvadvk/pen/demRqX