Solved

Condidional <a href = ....>

Posted on 2016-11-01
1
24 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

706 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now