チェックボックスにイベントを追加
876 ワード
https://developer.mozilla.org/ko/docs/Web/API/GlobalEventHandlers/onchange
addEvents();
function addEvents() {
var checkBoxes = document.querySelectorAll('#taskList input[type="checkbox"]');
//console.log(checkBoxes)
for (var index in checkBoxes) {
checkBoxes[index].onchange = updateJSON;
}
}
function updateJSON() {
var key = event.target.value;
console.log(key, event.target.checked)
dataJSON.할일들[key] = event.target.checked
}
Reference
この問題について(チェックボックスにイベントを追加), 我々は、より多くの情報をここで見つけました https://velog.io/@drv98/체크박스에-이벤트-달기テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol