checkbox on click jquery
//jQuery listen for checkbox change
$("#myCheckBoxID").change(function() {
if(this.checked) {
//I am checked
}else{
//I'm not checked
}
});$(document).ready(function() {
//set initial state.
$('#textbox1').val($(this).is(':checked'));
$('#checkbox1').change(function() {
$('#textbox1').val($(this).is(':checked'));
});
$('#checkbox1').click(function() {
if (!$(this).is(':checked')) {
return confirm("Are you sure?");
}
});
});$('input[type="checkbox"]').click(function(){
if($(this).is(":checked")){
//input element where you put value
$("#isClicked").val("Yes");
// console.log($("#isClicked").val());
}
else if($(this).is(":not(:checked)")){
$("#isClicked").val("");
// console.log( $("#isClicked").val());
}
});
Also in JavaScript:
- javascript remove duplicate strings from array
- check if element is last child jquery
- angular on back skip routes
- compare two array javascript
- math.floor
- react how to export component
- js detect device
- javascript arrays codeburst
- access css property using javascript
- does json only support ascii
- pipe of date angular
- react native header
- clone an object in javascript
- javascript fetch json
- Material-ui bank icon
- how to create a smooth effect in javasript
- javascript text to array
- jquery set checkbox checked
- how to pass dynamic string in string javascript
- Javascript get classes list
- add select option jquery
- how to write a program that alerts the current month in words in javascript
- javascript animate elements
- setting multiple styles in javascript