Could anyone please corret me with what I’m doing wrong on scenario below?
I’ve got bunch of document.getElementById statement which I would like to convert in to JQuery each loop. Some reason it’s not working, please see my jquery below:
$('.select').each(function () {
$(this).addEventListener('touchstart', function (e) {
e.stopPropagation();
}, false);
});
In nustshell, i’m trying to attach addEventListner to all the select elements.
You are selecting elements with a class name of
select.Drop the
.and it will selectselectelements.Also, you can bind that event with jQuery without having to explicitly iterate over the set.
This is what it should look like…