Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Condidional <a href = ....>

Posted on 2016-11-01
1
Medium Priority
?
50 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 2000 total points
ID: 41869371
Yes; demo here: https://jsfiddle.net/gny3dnew/

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

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

885 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