checkbox checked if condition javascript
if (document.getElementById('id of the check box here').checked) {
// it is checked. Do something
} else {
// it isn't checked. Do something else
}
if ($('input[name="transport"]').is(':checked')) {
alert('checked');
alert($(this).attr('id')); //To get ID of checkBox
}<input type="checkbox" onchange="doSomething(this)">
function doSomething(element){
var isChecked=element.checked;
//do some action if it is checked
}
Also in JavaScript:
- js deep serialize url array
- ngx-translate angular 11
- how to get property names from object using map method react
- javascript take first element of array
- create react element with string
- how to install node js in ubuntu
- capitalize first letter of each word javascript
- node js write read string to file
- dark mode with react hooks
- schema mongoose
- how to check if a kendo drop down is enabled js
- jquery when you typing in input
- javascript uppercase first letter of each word
- react can't import file 3 folders up
- on reload js
- TextInput disable react native
- anonymous functions javascript
- queryselector by class javascript
- Convert JS date time to SQLSERVER datetime
- decimal to base 32 javascript
- add element to array javascript
- button click function in js
- react useref in useeffect
- sort data according to date in js