It's a real mystery, but somehow I cannot detect checkbox click or change with the following code:
jQuery(document).ready(function () {
jQuery(document).on("click", "#item_configuration_item_selected", function() {
console.log("click");
});
});
It works with any other element, but not checkboxes.
When I try to detect the clicked element with this:
jQuery('body').click(function(event){
var id = event.target;
console.log(id);
});
then again, it shows a clicked element id for any other element, except checkbox. I'm just going crazy figuring this out.
Element html looks like this:
<div class="span3">
<label for="item_configuration_item_selected" class="checkbox">
<input type="checkbox" class="fabrikinput " name="item_configuration_item_selected[0][0]" id="item_configuration_item_selected" value="1"><span>MyLabel</span></label>
</div>
Any hint would be highly appreciated.
Edit added snippet
jQuery(document).ready(function() {
jQuery(document).on("click", "#item_configuration_item_selected", function() {
console.log("click");
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="span3">
<label for="item_configuration_item_selected" class="checkbox">
<input type="checkbox" class="fabrikinput " name="item_configuration_item_selected[0][0]" id="item_configuration_item_selected" value="1"><span>MyLabel</span></label>
</div>
Aucun commentaire:
Enregistrer un commentaire