EDIT: Also, both your examples have too few closing curly brackets. There should be a final one closing out the function selectOnTouch() in both. The second example also needs one more at the end of line 2.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
What happens if you change
to
?
I'm not sure what line 4 above would actually do though? Seems to me like it's only defining a function - not executing it.
I would probably try a rewrite to something like
possibly switching line 6 and 7 around.
Does any of that make it work?
EDIT: Also, both your examples have too few closing curly brackets. There should be a final one closing out the function selectOnTouch() in both. The second example also needs one more at the end of line 2.