Currently, I am using the following code to change the class of elements on touch:
ontouchstart="$(this).addClass('select');" ontouchend="$(this).removeClass('select');"
I was wondering if there is a more efficient way to achieve this functionality:
$("#element").touchstart(function(){
$(this).addClass('select');
},
function(){
$(this).removeClass('select');
});
This would allow me to specify multiple elements that should have this behavior. I've attempted different approaches but haven't been successful in making it work.