Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8152337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:40:58+00:00 2026-06-06T15:40:58+00:00

My web application uses a lot of <a href=#>Perform client script action</a> anchor links

  • 0

My web application uses a lot of <a href="#">Perform client script action</a> anchor links which are used for scripting (a habit I picked-up from my days as a Dreamweaver user well over 10 years ago) and now I’m beginning to question if this is necessary.

I don’t actually know why <a href="#"> is used in the first place – my guess is the presence of the href attribute causes browsers to apply the :link and :visited psuedo-classes which simplifies stylesheets. It also makes the browser implicitly apply the cursor: pointer property which may be desirable.

I use jQuery (after a brief stint with MooTools) and the links work just as well without the href="#" attribute and value, so should I just remove the attribute entirely and modify my stylesheet to compensate for the removal of the :link psuedo-class? Is there anything else I might be missing, any kind of semi-documented voodoo that the href attribute imbues the anchor element?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:41:00+00:00Added an answer on June 6, 2026 at 3:41 pm

    <a> stands for anchor

    If you include the [href] attribute on an <a> element, it is an anchor that points to a location, which means that you could go to a new page, a particular fragment of the current page (hence the # being called the fragment identifier), or a particular fragment of a new page.

    <a> elements without an [href] attribute were historically assigned a [name] attribute, which could be used as the destination of the fragment identifier. Browsers later added support for linking to any item’s [id] attribute, and this is now the preferred method for linking to a document fragment.

    What does this mean for standalone <a> elements?

    An a[href] element is a link (which is why they are matched with :link in css). links are clickable. An a element without the [href] attribute is otherwise just a placeholder for where a link might otherwise have been placed, and not clickable, nor are they in the tabbing order of the page.

    If you want your links to be keyboard navigable which is important for accessibility (WAI-ARIA), you’ll need to do one of the following:

    • change the element to <button type="button">
    • keep the [href] attribute
    • add [tabindex="0"] and one of [role="button"] or [role="link"] (and possibly some styling)

    More information about the [role] attribute can be found in the Roles Model section of the WAI-ARIA docs.

    Changing the markup

    If you don’t have a reason to keep the [href] attribute, you might as well be using a <button> element:

    <button type="button">
            ^^^^^^^^^^^^^
    

    The [type] attribute is used to make the element a generic button, otherwise <button> will default to [type="submit"], which may not be desirable as it could trigger form submission.

    If you can’t use a <button> (usually occurs when the inner markup must contain a <div>) you can fake a <button> using:

    <div role="button" tabindex="0">Some clickable text</div>
    

    You’ll need to listen for keypress events and trigger click events for Enter and Space.

    Keeping the markup

    If you’re keeping the <a> element and its [href] attribute, there are a number of options for its value.

    A real link

    E.x.

    • <a href="/some/location/for/users/without/js">
    • <a href="#document-fragment">

    If you need to provide support for users with JS disabled, you might as well direct them to a page that performs equivalent functionality without JS.

    By extension, this also includes providing document fragment links to link to the content within the same document. For example, a toggleable region may be marked up as:

    <a href="#more" class="toggleable">Read More</a>
    <div id="more">Lorem ipsum dolor sit amet</div>
    

    So that with JS the region can be collapsed and expanded, and without JS the link will take the user to the appropriate content on the page.

    A dud href

    E.x.

    • <a href="#">
    • <a href="javascript:void(0)">
    • <a href="about:blank">

    If you’re preventing the default behavior behind-the-scenes in JavaScript, and you’re not supporting users with JS disabled, you can use a “dud” href value to keep the link in the tabbing order and automatically enable Enter to trigger the click event. You should add [role="button"] as semantically the <a> tag is no longer being used as a link, but as a button.

    <a href="#" role="button">Some clickable text</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write an application which uses a lot of java script inside
I'm implementing a high traffic client web application that uses a lot of REST
I develop a web application which uses a lot of JavaScript. I developed first
I am developing a web application in grails which uses lot of ajax.I need
I have a php web application that uses big cookies to store a lot
I am debugging an web application that uses MySQL. I am seeing lot of
I have an internal web application, that is IE specific, and uses a lot
I have a web application that uses two databases. DB1 Users perform their CRUD
I have a web application that uses a library which resides in TOMCAT_HOME/common/lib. This
I'm automating the manual testing of some Web Application. This app uses a lot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.