Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 52
  • Last Modified:

Condidional <a href = ....>

I need to have an anchor tag that will be followed through depending upon a condition. I see to recall I can do something like <a href="somepage.html" onClick="return chk_link();">xxx</a>

If I don't want the link followed, the chk_link() Javascript will return false, otherwise true.

Does that work?

Thanks
0
Richard Korts
Asked:
Richard Korts
1 Solution
 
Terry WoodsIT GuruCommented:
Yes; demo here: https://jsfiddle.net/gny3dnew/

Javascript:
chk_link = function() {
  return false;
}

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now