Solved

Condidional <a href = ....>

Posted on 2016-11-01
1
32 Views
Last Modified: 2016-11-01
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
Comment
Question by:Richard Korts
1 Comment
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points
ID: 41869371
Yes; demo here: https://jsfiddle.net/gny3dnew/

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

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Page auto-refreshes when scrolled on iPhone. 5 55
multiple selects 23 49
Search Item in Table 2 23
message Alert on an empty search 10 22
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question