Logic Machine Forum
Javascript event off on iPad - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Javascript event off on iPad (/showthread.php?tid=787)



Javascript event off on iPad - buuuudzik - 16.05.2017

Do somebody knows how to limit events generating on "vclick"? I've prepared the .lp file which generates a table with hvac controllers values. I want prepare some functions which are based on "vclick" but I must have a solution for generating only 1 click on real 1 click but default javacript reaction is that for 1 real click there are 17 "vclick" events.

I've tried something like this:
Code:
    $('.table > tbody > tr > td:nth-child(3)').on('vclick', function(){
    console.log(this.innerText)
    $( this ).off( event.type );
    });

and its working on every webbrowsers only not on Safari(PC, iPad).

Maybe somebody can give some advice what can be improved in above script?


RE: Javascript event off on iPad - admin - 16.05.2017

You're missing event argument in function, it should be .on('vclick', function(event){. You can also replace "on" with "one", so you don't even need to call "off".


RE: Javascript event off on iPad - buuuudzik - 16.05.2017

(16.05.2017, 10:40)admin Wrote: You're missing event argument in function, it should be .on('vclick', function(event){. You can also replace "on" with "one", so you don't even need to call "off".

The problem was the function which was in the for loop because of the "}" in the wrong place. But thanks for helpWink Now I know about .one() function alsoWink


RE: Javascript event off on iPad - buuuudzik - 16.05.2017

I had still a little trick with iPad but when I've changed "vclick" to "click" all starts working as I want.