Issue
I use jQuery, I need to make some anchor tags perform no action.
I usually write it like this:
<a href="#">link</a>
However this refers to the top of the page!
Solution
If you don't want to have it point to anything, you probably shouldn't be using the <a>
(anchor) tag.
If you want something to look like a link but not act like a link, it's best to use the appropriate element (such as <span>
) and then style it using CSS:
<span class="fake-link" id="fake-link-1">Am I a link?</span>
.fake-link {
color: blue;
text-decoration: underline;
cursor: pointer;
}
Also, given that you tagged this question "jQuery", I am assuming that you want to attach a click event hander. If so, just do the same thing as above and then use something like the following JavaScript:
$('#fake-link-1').click(function() {
/* put your code here */
});
Answered By - Tyson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.