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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:40:21+00:00 2026-06-11T22:40:21+00:00

I am creating a menulist popup list dynamically. I the editable and open attributes

  • 0

I am creating a menulist popup list dynamically. I the editable and open attributes to true. What I would like to be able to do is to be able to add a new menulist item when the user types in an item that is not already present. Is this possible? If so, how?

I am creating the list like so:

var ml = document.createElement("menulist");
ml.setAttribute("editable","true");
ml.setAttribute("open","true");
ml.setAttribute("oncommand","alert(this.value)");
var mp = document.createElement("menupopup");
var mi = document.createElement("menuitem");
mi.setAttribute("label","item1");
mi.setAttribute("value","1");
mp.appendChild(mi);
//add as many items as i feel
ml.appendChild(mp);

When the value is changed, the alert function is fired when the item is changed but when I type in anything, it is not fired. Basically, I want to eventually pass the value to a funcntion I call from here to add the item to the list.

  • 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-11T22:40:23+00:00Added an answer on June 11, 2026 at 10:40 pm

    First of all, you should seriously consider using addEventListener instead of changing attributes like oncommand:

    ml.addEventListener("command", function(event) {
     alert(this.value);
    }, false);
    

    If you want to be notified about changes in the text field then you should add an event listener to the text field:

    ml.appendChild(mp);
    ml.inputField.addEventListener("input", function(event)
    {
      alert("Text field value changed");
    }, false);
    

    Note that this has to be done after the element is added to the document, before that the inputField property will not be defined (corresponding XBL binding didn’t apply yet).

    For reference: menulist.inputField, input event

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

Sidebar

Related Questions

Creating a popup window from main page with window.open, the child/popup page uses the
Creating function to print question, add choices to a list. def print_et_list (): answer_list
Creating a custom sync() method in backbone. I would like to do this the
all I am creating my menu list in footer dynamically. now in one row
Creating an item(Under the key) is easy,but how to add subitems(Value)? listView1.Columns.Add(Key); listView1.Columns.Add(Value); listView1.Items.Add(sdasdasdasd);
creating a small web application to be deployed on Heroku, where we would like
Creating a class at runtime is done as follows: klass = Class.new superclass, &block
Creating a calculator-like dialog, I noticed that quickly clicking on a button in IE
Creating a table without tbody using javascript createElement/appendChild will not add tbody in Firebug
Creating a Drawable that is completely empty seems like a common need, as a

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.