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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:43:15+00:00 2026-05-15T21:43:15+00:00

this is a nutts job here. Not sure if jquery can handle this. I

  • 0

this is a nutts job here. Not sure if jquery can handle this. I have a php page called page1.php where I have drop down like this

<select id="startRecord" >
   <option value="0"></option>
</select>  

Now I caclulate some values here and then send the values to page2.php. Now on page2.php I do some more caclulations and rum a query. If the result of the query is more than 30 records I want the drop down on page1.php reflect that so my users can select the query. so lets say that the result of the query on page2.php was 70, the drop down on page 1 should change to this

<select id="startRecord" >
   <option value="0">0-30</option>
   <option value="30">31-60</option>
   <option value="61">61-70</option>
</select>  

I am thinking I would need innerHtml or .html(). But not sure how to implement this for this case scenario.

  • 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-15T21:43:15+00:00Added an answer on May 15, 2026 at 9:43 pm

    Not sure I completely follow your question but if you are asking how to add items to a dropdown with jquery you can do something like this:

    $('#startRecord').append(
        $('<option></option>').val("30").html("31-60")
    );
    

    EDIT: Sorry it took so long. We have some people over the house right now. Here you go. Hope this helps:

            $(document).ready(
                function () {
                    $("#startRecord option").remove();
    
                    var total = 30;
                    var results = 100;
                    var lastOption = { Value: -1, End: 0, toString: function () { return this.Value.toString() + "-" + this.End.toString() } };
                    var counter = 0;
    
                    while (parseInt(results / total, 10) >= counter) {
                        lastOption.Value = total * counter + (lastOption.Value == -1 ? 0 : 1);
                        lastOption.End = lastOption.Value + total - (lastOption.Value == 0 ? 0 : 1);
                        lastOption.End = (lastOption.End > results) ? results : lastOption.End;
                        $('#startRecord').append(
                            $('<option></option>').val(lastOption.Value.toString()).html(lastOption.toString())
                        );
    
                        counter++;
                    }
                }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, this is driving me nuts. I've done just about everything I can to
NHibernate is driving me 'Nuts'!!! I have the following mapping. Which returns this error
This is a bit of a long shot, but if anyone can figure it
This is my first post here and I wanted to get some input from
This is nuts. I have an ASP.NET MVC application using Windows authentication that, amongst
This is driving me nuts. I can't work it out stepping through with Firebug
i'm getting nuts with an regular expression. I have a string like this: %closed%
This is just taking too long. Cannot install visual studio, i have a msdn
I have an article 'tag' sidebar which is positioned correctly on the Home page,
This is driving me nuts. I am using some 3rd-party code in a Windows

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.