www.webdeveloper.com
Results 1 to 2 of 2

Thread: dynamically add dropdown menu.

  1. #1
    Join Date
    Oct 2011
    Posts
    5

    dynamically add dropdown menu.

    Im having trouble with this code. I have tried two versions, the first does nothing and the second works but it adds a listbox and not a dropdown menu. Im not sure what the deal is but I just want to add a dropdown menu dynamically when I click a button or link, I have that part coded, Im just having trouble getting the element right. Im using FF 7.01, but I would like to come up with something that is browser neutral.

    Please help. Thanks.

    1.
    var cellRight = row.insertCell(2);
    var ella = document.createElement('option');
    ella.type = 'select';
    ella.size = 2;
    cellRight.appendChild(ella);

    2.
    var cellRight = row.insertCell(2);
    var ella = document.createElement('select');
    ella.type = 'select';
    ella.size = 2;
    cellRight.appendChild(ella);

  2. #2
    Join Date
    Sep 2011
    Location
    India
    Posts
    21
    you just need to remove the

    Code:
    ella.size = 2;
    the size attribute specifies the number of visible options in a drop-down list.

    if you give two then it will create a ListBox ,as we can have only one option visible for a dropdown , but you are specifying size=2 , so its creating ListBox


    Thanks
    Mourya

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles