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

  • Home
  • SEARCH
  • 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 6240851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:38:50+00:00 2026-05-24T11:38:50+00:00

This isn’t quite the same question as many others that it might resemble. Consider

  • 0

This isn’t quite the same question as many others that it might resemble.

Consider a table full of sortable columns. The ascending/descending sort order that the visitor wants is kept in a <span> in the column’s <th>. JavaScript code refers to that <span> when the user calls for a sort; and the code changes the contents of the <span> as the user toggles the sort order.

Considering both the code and the HTML, is it “better” (cleaner, JS-friendlier, more concise, nicer-looking) practice to annotate the <span> part of the <th> this way:

<span class="sortorder"><span class="ascending">content</span></span>

or this way:

<span class="sortorder ascending">content</span>

The first way makes it easier for code to track down the column’s sort order. The second way rids the HTML of a lot of cruft. As it seems to me.

Thanks!

  • 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-05-24T11:38:51+00:00Added an answer on May 24, 2026 at 11:38 am

    It seems like what you’re trying to do is to add a key=value pair to the element that says “the sortorder of this is ‘ascending'”. For this I’d use HTML5 data attributes:

    <span data-sort-order="ascending">…</span>
    

    They should be backwards-compatible and jQuery should be able to find / read them on any browser they support using .data().

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

Sidebar

Related Questions

This isn't actually a homework question per se, just a question that keeps nagging
This isn't a development question, I'm Looking for a plugin for Joomla that allows
I hope this isn't a stupid question, but after searching around for quite a
This isn't that complicated of a question, but I can't wrap my head around
This isn't a question that has a black/white yes/no answer, this is more a
This isn't a holy war, this isn't a question of which is better. What
This isn't a question but I thought I'd start a thread where links to
This isn't quite as straight forward as one may think. I'm using a plugin
This isn't really a programming question but more about programming and testing tools. Is
This isn't meant as a troll or flamebait or anything like that. I've been

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.