I'm trying to make my website work on all mobile devices, including iOS. I order to do it I had to use a clickHandler function as suggested here How to replace click with touchstart on iOS devices
I need to get a value but using $this I receive the error "is not defined".
<button class="open" value="{{ item.id }}">open</button>
var clickHandler = ('ontouchstart' in document.documentElement ? "touchstart" : "click");
$(".open").bind(clickHandler, function(e) {
var id = ($this.attr('value'));
$("#item" + id).addClass("visible");
});
Any suggestion? Thanks!