bantikyan/icheck-bootstrap

how to change the checked state with javaScript

bosslichuan opened this issue ยท 4 comments

Sometimes, checkbox needs to change the state with js, so how can it do that.
thanks!

Hello @bosslichuan , you have to change state similar as with regular input with type="checkbox".
icheck-bootstrap is just css styling to change checkbox look.

With js you can look at: https://www.w3schools.com/jsref/prop_checkbox_checked.asp
With jQuery: https://learn.jquery.com/using-jquery-core/faq/how-do-i-check-uncheck-a-checkbox-input-or-radio-button/

Thanks for your solution.
yeah, I had try to do like that with JQuery, but it didn't work.
It still displayed as the initionalized style whether it had been checked or not.

I guess you will add the JS events to it. ๐Ÿ˜„๐Ÿ˜„

Hi @bosslichuan I think you are doing something wrong. Can you try with regular checkbox, on same place and see if it works?

About JS event, No. The idea of this project is to have all in pure css ;)