javascript event listener checkbox
//js
var checkbox = document.querySelector("input[name=checkbox]");
checkbox.addEventListener( 'change', function() {
if(this.checked) {
// Checkbox is checked..
} else {
// Checkbox is not checked..
}
});
//jquery
$('input[name=checkbox]').change(function(){
if($(this).is(':checked')) {
// Checkbox is checked..
} else {
// Checkbox is not checked..
}
});
Also in JavaScript:
- switch in javascript
- creating a json model sap ui5
- iterate object javascript
- next.js google script
- js change key value in object
- jquery check input is disable
- the word need blinck for seconds later it need to move for next place using javascript
- horizontal tabs in react js
- Detect the city on application launch via geolocation react native
- how to uncheck a checkbox in jquery
- alphabetical order array javascript
- alphabet only in jquery
- javascript exercism.io bob solution
- javascript style background color
- react detect finger
- run javascript when typing
- regular expression number from 1 to 100
- javascript example of foreach loop
- if variable is string javascript
- iframe content zoom in and zoom out jquery
- check unique object in array javascript site:stackoverflow.com
- firebase app named default already exists react native
- javascript requestanimationframe stack overflow
- react native whatsapp integration