Topic: initialize checkbox to checked using javascript
                  
                  Taomgirl
                  pro
                  asked 7 years ago
                
                I want to change checkbox to checked based on an if statement in my code.
I don't see any documentation on how to manipulate them since the id seem to tie to their state.
                
                  
                
                
                
              
              
            
                      
                      Taomgirl
                      pro
                        answered 7 years ago
                    
                    I want to check the box based on code not user clicking a button.
                    
                      
                    
                    
                    
                      
                      
                        
                        
                          
                          
                          
                            
                        
                        
                      
                    
                    
                  
                  
                Piotr Glejzer staff commented 7 years ago
Hi, Something like that? if($('#your-checkbox-id').is(':checked')){ // do something } else{ // do smething } Best, PiotrFREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
              Answered
Specification of the issue
              - ForumUser: Pro
 - Premium support: No
 - Technology: MDB jQuery
 - MDB Version: 4.5.10
 - Device: mac
 - Browser: chrome
 - OS: ios
 - Provided sample code: No
 - Provided link: No
 
Piotr Glejzer staff commented 7 years ago
Hi, what exactly do you want? Which if / else statement? Best, Piotr