I'm trying to run a function on an element "onmousedown". Here's the code:
<label class="switch">
<input type="checkbox" onmousedown="console.log('Run the function');
manageBook(this);" id="element-id-52" data-mode= "offx">
<span class="slider round"></span>
</label>
But when I click the slider, I don't see either the console.log() message or the function running. Any idea what could be causing this?
Try adding the listener to the label instead of input element.
<label
class="switch"
onmousedown="console.log('Run the function'); manageBook(this);
>