jQuery Ajax checkbox state

后端 未结 5 519
耶瑟儿~
耶瑟儿~ 2021-02-04 11:33

I have checkboxes on my page for which I would like to send their state back to the database via ajax. I know how to use jquery with ajax, but I don\'t know how to get the chec

5条回答
  •  醉话见心
    2021-02-04 11:54

    if ($("#yourCheckboxID").is(":checked")) {  
        // checkbox is checked 
    } else {
        // checkbox is not checked 
    }
    

    will do the job.

提交回复
热议问题