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 8108127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:59:52+00:00 2026-06-06T00:59:52+00:00

When using jQuery events such as click, mouseover and so, are there big differences

  • 0

When using jQuery events such as click, mouseover and so, are there big differences between using an anchor and a span? Anchors have hover states which can be called in jQuery, but apart from that, would it be good practise to use spans instead? (or divs, or any other element for the purpose). Suppose I want to dynamically change some classes and open a tooltip… This is just an example, I’m wondering if it’s something that is “not recommended” by some reason.

Edit: Anchors only allow inline elements inside, that’s one of the limitations that made me wonder if it would be a bad practise, because inside anchors I can only have spans. The anchors I’m using don’t point anywhere, I’m using them only to take advantage of hover styles in css without having a long and repetitive script.

Example:

<span class="class">
    <p>Some text I don't want to use</p>
    <a class="anchorClass" href="#">Anchor with a specific behaviour</a>
</span>

<a class="class" href="#">
   <p>Some other text I don't want to use but I want it to be inside the anchor</p>
   <span class="spanClass">Span with a specific behaviour</span>
</a>
  • 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-06T00:59:54+00:00Added an answer on June 6, 2026 at 12:59 am

    If the element points to a specific location that can be bookmarked or sent as a direct link, use an <a> tag. If not, just use a <span>. That way your application will degrade gracefully for people with JavaScript disabled.

    I’m not sure what else to suggest. That is usually what rule I follow when interchanging the two.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an events page using jquery mobile. I have a stylish way
I am using jquery fullcalendar and it works great. My events come in from
I'm using jGesture jquery library for gesture events. As per the documentation, delta and
I'm using jQuery to capture a click event on a checkbox and call a
I am using jQuery to attach a function to my click event for an
Using class name I am firing a click event in jquery. Class names are
I have a <span> button, which calls some jQuery, I need a way to
I have a trouble using an element with jquery. I am constructing the name
I'm interested in using JS events such as right\left arrow, space bar etc. Wondering
I am using jquery 1.6.2. Basically in one of my pages, I have a

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.