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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:39:21+00:00 2026-06-07T09:39:21+00:00

I am reading a Chrome extension codes. In one of its html files (used

  • 0

I am reading a Chrome extension codes. In one of its html files (used for setting), the source code shows that there is a select element like this

<select id="hostselect"></select>

Note that there is no option element as the child of the select element. However, if I open the setting page of the extension in Chrome, there is a drop-down list corresponding to that select element, and moreover, if I use the Chrome developer tool to inspect this setting page, it shows that the select element has option children:

<select id="hostselect">
  <option value="host1">host1</option>
  <option value="hots2">host2</option>
</select>

I don’t understand why there is no option child if I view the source code of the setting page in text editor, while the option children appear when I view the page’s DOM using Chrome developer tool. What could be the most possible reason for this? Could some content scripts in the extension change the DOM of the setting page? Also, what’s the benefit to write codes like this?

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-06-07T09:39:24+00:00Added an answer on June 7, 2026 at 9:39 am

    I do this for an extension at work. I am using Javascript to load extra options in to the select. I do this because the number of options is dynamic. I don’t have source available now but I can post an example later if you would like

    Update

    Here is an example of some javascript that might populate your select element. I am using jQuery to append the options and to iterate over my list of hosts with jQuery’s each. I have two static options “Default” and “None” the the dynamic list which was generated with getHosts()

    var hosts = getHosts();
    if(hosts) {
        var selectElement = $("#hostSelect");
        selectElement.append($("<option></option>").attr("value", "0").text("-- Default Host --"));
        selectElement.append($("<option></option>").attr("value", "-1").text("-- No Host Selected --"));
        $.each(hosts, function(key, host) {
            selectElement.append($("<option></option>").attr( "value", host.getHostID() ).text( host.getName() ));
        })
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading this http://lists.w3.org/Archives/Public/public-webapps/2011JulSep/1622.html and it seems that Chrome's behavior contrasts to specification.
Reading this list of Chrome match patterns: http://code.google.com/chrome/extensions/match_patterns.html How do I specify a match
I started reading Google Chrome's documentation, and liked it's approach of using HTML and
I have the following line of code that works fine in Firefox, Chrome and
I'm reading a tutorial about Firefox extensions and one of the important files is
I'm trying to make a chrome extension on my toolbar that, when clicked, will
I remember reading about a way to develop a Google Chrome extension without constantly
I am developing a Chrome extension that needs to package an XML file (a
I reading through the default styling applied to HTML elements for Google Chrome, available
I'm reading Chrome's extension localStorage in my content script. If I log the variable

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.