leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

How to Execute JS action on an Html link Click

I wonder how to achieve getting an html link to trigger a JS action rather than the usual url target action. What I need to do is to get JS to collect data from an xml rest service and do something with it. Thanks.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to Execute JS action on an Html link Click

If you don't need to navigate to another site after you click on Link component, you can just use Label component.

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

How to Execute JS action on an Html link Click

There would be many links in body of the html rendered within the component. Can I still use the Label component to do that and render it as html? How is the link captured and sent to JS?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How to Execute JS action on an Html link Click

Sorry, not sure I understand. Could you explain in more details please?

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

How to Execute JS action on an Html link Click

I'm sorry Marina. I mean the html text that i will put on either the Label or Panel component will have many links within, not just one. Can I use Label component to render such html text with multiple links. Regardless of whether I use Label or Panel, how can I call JS on a link click action instead of navigating to a url?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to Execute JS action on an Html link Click

Use Run JavaScript action. There you can run any JavaScript.

http://docs.appery.io/documentation/a...

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to Execute JS action on an Html link Click

HI,

You can use Textarea component.
Create javascript function on separate js file.
precode
$(function() {
$("#linkclick").click(function(e) {
// methods to call...
});
});
/code/pre

then use this function on html link

precode
<a id="linkclick" href="http:&#47;&#47;jquery&#46;com">jquery<&#47;a>
/code/pre

Return to “Issues”