Results 1 to 3 of 3

Thread: Replace options in a select

  1. #1
    Join Date
    Sep 2008
    Posts
    15
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Replace options in a select

    Hi there,

    I'm trying to replace the options in a select but without luck, it works fine on FF but not on IE.
    I think this is a very basic question but i cannot figure it out. I'm trying to use the innerHTML as I'm using AJAX to retrieve a response and the response is something like "<option value="modelA">Model A</option>", i even tried with following code but doesn't seems to work on IE, it just empties the select.

    HTML Code:
    <select name="lbModel" class="big" id="lbModel">
                      <option value="0">Model</option>
    </select>
    <a href="javascript:replaceOptions()">Replace</a>
    Code:
    //javascript
    
    function replaceOptions(){
    var obj = document.getElementById("lbModel");
    obj.innerHTML = '<option value="modelA">Model A</option>';
    }
    Please can anyone help this newbie.

  2. #2
    Join Date
    Sep 2008
    Posts
    15
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default upgrade

    i've been tryinh to understand this and in IE it actually writes.

    Here is the innerHTML in IE
    HTML Code:
    Model A</OPTION>
    its missing the initial <option>

    Why?


    Thanks

  3. #3
    Join Date
    Sep 2008
    Posts
    15
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Solution or better a BUG


Bookmarks

Posting Permissions

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