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 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

he this has been driving me nutts, and I hope someone can shed some
This is driving me nuts, I can't see the problem. Using jQuery (I'm stuck
I'm going nuts on this. (as most people posting here lol) I have a
I use CakePHP 2.0 I am following this guide http://nuts-and-bolts-of-cakephp.com/2009/01/19/jquery-in-the-cakephp-world-part-1/ I have included in
This is driving me nuts. I'm not sure what else to try. This is
This is making me nuts and I'm sure the answer is SO easy. I
This is driving me nuts. I can't seem to get the data template within
This has been driving me nuts. I hope it's not been asked before but
This is really driving me nuts, I have a datagridview bound to a bindingsource,
This problem drives me nuts, because the max_execution_time in the php.ini and in the

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.