How to add JavaScript function and call it from onClick event in outsystem mobile app

Hi,

I have list of <li> and when user click on li tag so a onClick event should be call and some code in the JavaScript function should be execute. 

Example :

JavaScript :

function myfunction()

{

    alert('Hello');

HTML :

<li onClick ="myfunction()">Item1</li>



s there any solution for implementing this login in OutSystem Mobile app not in web.

Shailendra Shrivastava wrote:

Hi,

I have list of <li> and when user click on li tag so a onClick event should be call and some code in the JavaScript function should be execute. 

Example :

JavaScript :

function myfunction()

{

    alert('Hello');

HTML :

<li onClick ="myfunction()">Item1</li>



s there any solution for implementing this login in OutSystem Mobile app not in web.


Hi Shailendra,

Plese, refer to this documentation.

https://success.outsystems.com/Documentation/10/Extensibility_and_Integration/JavaScript/Extend_Your_Mobile_App_Using_JavaScript


Regards,

PP

pankaj pant wrote:

Shailendra Shrivastava wrote:

Hi,

I have list of <li> and when user click on li tag so a onClick event should be call and some code in the JavaScript function should be execute. 

Example :

JavaScript :

function myfunction()

{

    alert('Hello');

HTML :

<li onClick ="myfunction()">Item1</li>



s there any solution for implementing this login in OutSystem Mobile app not in web.


Hi Shailendra,

Plese, refer to this documentation.

https://success.outsystems.com/Documentation/10/Extensibility_and_Integration/JavaScript/Extend_Your_Mobile_App_Using_JavaScript


Regards,

PP


Hi pankaj, I checked this document but not able to call defined  JavaScript function from JavaScript node.

Hi Shailendra,

On the course materials of this masterclass, there's a module (mobile specific)  that exemplifies all the ways to add to an onclick event, a javascript function. Download the course materials, and open the oml file to inspect how they do it.

https://www.outsystems.com/learn/courses/44/master-class-on-javascript-and-jquery/

It would be nice for you to look into documentation and even do the masterclass for you to understant step by step, and how better performant those solutions are.

https://www.outsystems.com/learn/lesson/1136/javascript-and-jquery-in-mobile-applications/

don't forget to take into account best practices:

https://success.outsystems.com/Documentation/Best_Practices/OutSystems_Mobile_Best_Practices#JavaScript