little star
little star

Reputation: 88

"href" links in JavaScript Android not working

I'm new to Android/iOS applications. I made an app using PhoneGap, and I built it. Anyway, the links that are written like this are not working:

<a href="javascript:functionName();">click me</a>

What is the best way to fix it?

Upvotes: 0

Views: 796

Answers (2)

jcarrera
jcarrera

Reputation: 1068

You can try this way:

<a id="anchorID">click me</a>

$("#anchorID").on("click", function() {
   // your JS code
});

Upvotes: 2

ashinn
ashinn

Reputation: 109

You can try something like this:

<a onClick="functionName();" href="javascript:void(0)">click me</a>

Upvotes: 3

Related Questions