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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:46:29+00:00 2026-06-06T22:46:29+00:00

I have a problem with adding OPTIONS to SELECT tag dynamically. Here is my

  • 0

I have a problem with adding OPTIONS to SELECT tag dynamically.

Here is my code of Job.html:

<body onload="javascript:onPageLoad();">
<div id="JobForm" data-role="page"> 
    <div class="logoHeader"><img src="images/header.png" /></div> 
    <div data-role="header" data-position="fixed">
        <h1>Load<span id="JobHeader"></span></h1>
    </div>  
    <div class="lineBreak20"></div>
    <div class="rightContent divContent">Welcome<em id="lblName"></em></div>
    <div class="lineBreak40"></div>
    <div class="boldText divContent">Please select the Job</div>
    <div class="lineBreak20"></div>
    <div class="roundBox">
        <table>
                <tr>
                <td class="tdLabel">Job No: </td>
                <td><select id="ddJNo" class="fieldWidth" data-mini="true"></select>
                </td>
            </tr>
            <tr>
                <td></td>
                <td><button id="btnLd" type="submit" data-theme="a" data-inline="true" data-mini="true">Load</button></td>
            </tr>
         </table>
    </div>
</div> 
   </body>

and the Javascript is:

 function onPageLoad() {
var lsJobs= window.localStorage.getItem("jobs");
var arrJobs= lsJobs.split(",");
for (var i=0;i< arrJobs.length;i=i+2)
{
    if((arrJobs[i]!=""))
    {
    $("#ddJNo").append("<option value='"+ arrJobs[i] +"'>" + arrJobs[i+1] + "</option>");
    }
}
document.getElementById("lblName").innerHTML =window.localStorage.getItem("name");
 }

Is there any error in the code? Here the problem is when i click the Select option, the drop-down list is not showing. Please share ur ideas in implementing the SELECT options dynamically either using JAVASCRIPT or JQUERY.

UPDATE: But while placing the window.localStorage content in alert Dialog, it works fine. I think there is a problem with JS Function. Please help me…

  • 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-06T22:46:33+00:00Added an answer on June 6, 2026 at 10:46 pm

    Try this,

    var newOption = $("<option />");
    $("#ddlJobNo").append(newOption);
    
    newOption.val(arrJobs[i]); 
    newOption.html(arrJobs[i+1]); 
    

    See example here.

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

Sidebar

Related Questions

I have problem adding arraylist to list view, will explain about my problem here..
so I have a problem with dynamically adding items to menuStrip. I mean I
I have some problem with my .htaccess file. Here I am adding my problem.
I have the following html code <select id=WageBenifits_PayType name=WageBenifits.PayType> <option class=selectOption value= selected=selected>Please Select
I have the following bit of code. I'm trying to dynamically add drop-down options
I have a problem adding ADO.Net Entity Data Model to my existing project, or
I have a problem adding entities to a collection. public void SaveNotificationUsergroups(int bookingobjectID, int[]
I have a problem with adding filter for attribute, which exist not in all
I have a little problem with adding actions on UITabBarItems. I am not using
I've got a problem with adding Expanded event to my Expanders. I have expanders

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.