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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:27:16+00:00 2026-06-06T16:27:16+00:00

I have the following HTML that can appear but only one at a time:

  • 0

I have the following HTML that can appear but only one at a time:

<a id="menuRange" class="button" href="#">1 - 100</a>
<a id="menuRange" class="button" href="#">101 - 200</a>
<a id="menuRange" class="button" href="#">201 - 300</a>

and I used this code to get the range:

var $field = $('#menuRange');
var nums = $field.text().split('-').map(function (a) {
    return parseInt(a, 10) + d * 100
});

Now I want to change the HTML into:

<a id="menuRange" class="button" href="#">Lines 1 - 100</a>
<a id="menuRange" class="button" href="#">Lines 101 - 200</a>
<a id="menuRange" class="button" href="#">Lines 201 - 300</a>

How can I make it so I still get nums data like before. In other words, how
can I make it ignore the word “Lines ” as though it was not there?

  • 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-06T16:27:18+00:00Added an answer on June 6, 2026 at 4:27 pm

    If you want complete freedom in what you put in the anchors’ content move the value used by your code for calculations into an attribute. Then you can change your mind about the content the user sees without needing to change your JS code at all:

    <a id="menuRange" class="button" href="#" data-lines="1-100">Lines 1 - 100</a>
    <a id="menuRange" class="button" href="#" data-lines="101-200">Anything here</a>
    <a id="menuRange" class="button" href="#" data-lines="201-300">still works</a>
    
    var $field = $('#menuRange');
    var nums = $field.attr("data-lines").split('-').map(function (a) {
        return parseInt(a, 10) + d * 100
    });
    

    You could opt for separate attributes for the min and max:

    <a id="menuRange" class="button" href="#" data-min="1" data-max="100">Lines 1 - 100</a>
    

    And then you could retrieve them separately rather than splitting out from a single string:

    var min = $field.attr("data-min"),  // to get it as a string
        max = $field.attr("data-max");  // use .attr()
    // OR
    var min = $field.data("min"),       // to have jQuery automatically convert
        max = $field.data("max");       // it to a number use .data()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have some html that looks like the following: <div class='something unknown' id='something_unknown_1'>
I have the following HTML that pops up a window when I click the
I have the following html/css that is causing problems in Firefox 1.5 and 2,
I have the following html code: I saw that for Watir-webdriver the Watir::Image.file_size method
I have a following problem, I have HTML form that uploads a file with
I have a text file of HTML that includes the following marker set for
i have the following problem with that code in my html tag: <div id=searchbar><input
I have a simple html form that looks like the following <form action=search.php method=get>
I have a single .html file that looks similar to the following: <div id=myPage
I have following html in string and i have to extract the content only

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.