Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript change checkbox state

Javascript:
// Check
document.getElementById("checkbox").checked = true;

// Uncheck
document.getElementById("checkbox").checked = false;


jQuery (1.6+):
// Check
$("#checkbox").prop("checked", true);

// Uncheck
$("#checkbox").prop("checked", false);


jQuery (1.5-):
// Check
$("#checkbox").attr("checked", true);

// Uncheck
$("#checkbox").attr("checked", false);
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native new project 
Javascript :: modals in react native 
Javascript :: javascript find vs filter 
Javascript :: how to nested schema mongoose 
Javascript :: sort list in javascript 
Javascript :: how to use npm package in javascript 
Javascript :: vuejs methods 
Javascript :: looping object 
Javascript :: date.setdate javascript 
Javascript :: how to check if input field has value 
Javascript :: noise expression after effects 
Javascript :: how to add suffix to a string in javascript 
Javascript :: how in javascript can display date and select image 
Javascript :: remove equal objects in list of json js 
Javascript :: js for of loop 
Javascript :: JavaScript Constructor Function Parameters 
Javascript :: javascript Passing undefined Value 
Javascript :: js tilda 
Javascript :: javascript function definitions 
Javascript :: React ES6 Modules 
Javascript :: vite config js load env 
Javascript :: bring object to ckicked location 
Javascript :: find minimum 
Javascript :: phaser muy bridge 
Javascript :: Who likes it 
Javascript :: angular reactive forms bootstrap 4 
Javascript :: mobile angular service 
Javascript :: bootstrap 5 
Javascript :: empty array javascript 
Javascript :: what is slot in vue.js 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =