Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

jQuery event handlers don't work on mobile device (Kendo UI Mobile)

$
0
0

I ran into the following problem:

When something is clicked in my app, I need to run a function that retrieves a data-attribute from the object that has been clicked.

In the emulator I can run some jQuery that says

$("div[data-video-url]").click(function() {
   alert($(this).data('video-url'));
});

And it returns the correct value.

But when I run this on my phone the .click event handler does not fire.

Instead, I used data-click and wrapped alert($(this).data('video-url')); in a function that was called by data-click. However, this returns undefined (I believe because once inside the function, 'this' loses its scope).

Is there a way to get jQuery event handlers to work on mobile devices? Or is there another easy way to do what I need in Kendo UI Mobile?

One other thing: I can only get data-click to fire when it is attributed to an element with data-role="button". Is there way to attached data-click to elements that aren't buttons?

Thanks!


Viewing all articles
Browse latest Browse all 94857

Trending Articles