Answer the question
In order to leave comments, you need to log in
How to execute such function on click of checkboxes?
Greetings, tell me how to register to perform this function only not by the button id, but by clicking on each checkbox on the page?
js jquery
$(document).on('click', '#button', function(){
let txt = document.getElementById("keyPrivHex").value;
$.ajax({
url: 'test.php',
type: 'POST',
data: { txt: txt, },
success: function(data){
$('p.out').text(data);
},
error: function(){
console.log('ERROR');
}
})
})
document.querySelectorAll("input[type='checkbox']").forEach(item=>{
item.addEventListener('click', func)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question