Check an iCheck checkbox using JavaScript?


Check an iCheck checkbox using JavaScript?



How can I check an iCheck checkbox using JavaScript? Already tried the code:


document.getElementById("checkbox").checked = true;




2 Answers
2



From the Documentation:


$('input').iCheck('check');



It'd be good to read the documentation of any plugins you find online, as they usually contain many answers to your questions, thus avoiding the need to ask in forums.



Use $(element).iCheck('check'); where element is replaced with the desired element, e.g. document.getElementById('elementIdHere').


$(element).iCheck('check');


element


document.getElementById('elementIdHere')






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

PHP contact form sending but not receiving emails

PHP parse/syntax errors; and how to solve them?

iOS Top Alignment constraint based on screen (superview) height