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.
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.
If you don't need to navigate to another site after you click on Link component, you can just use Label component.
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?
Sorry, not sure I understand. Could you explain in more details please?
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?
Use Run JavaScript action. There you can run any JavaScript.
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://jquery.com">jquery</a>
/code/pre