Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2011
    Posts
    148
    Thanks
    18
    Thanked 0 Times in 0 Posts

    dynamic generated DropDOwn value not captured in IE

    hi Peers,

    i am having issue capturing the value of the selected DDL using IE.
    the code below works just fine in Firefox...


    // Create a new drop down list -- for text box use 'input' instead of 'select'
    var newDDL = document.createElement('select');

    // size lenght of the DDL for both IE or Firefox
    newDDL.setAttribute("style","width:300px");
    //firefox
    newDDL.setAttribute("width","300px");
    newDDL.style.width = "300px";
    newDDL.id = 'id' + elementid + ColumnElement;
    newDDL.setAttribute('name','newDDL'+ elementid+ColumnElement);

    // filling the DDL by ITEM array Elements
    var i=0;
    for (i=0;i<=rec_count;i++)
    {
    objOption = document.createElement('option')
    objOption.text = ITEM[i]
    newDDL.options.add(objOption)
    }

    counter++;
    newDDL.onchange = show1;

    both cases are giving the value selected in firefox

    function 1:
    function show1()
    {
    alert('id=' + this.getAttribute('id') + 'name = ' + this.getAttribute('name') + 'value=' + this.value );

    }

    function 2:
    function show1()
    {
    alert('id=' + this.getAttribute('id') + 'name = ' + this.getAttribute('name') + 'value='+ this.getAttribute('value'));

    }


    any suggestion will be appreciated
    thanks

  • #2
    New Coder
    Join Date
    Jan 2011
    Posts
    52
    Thanks
    0
    Thanked 9 Times in 9 Posts
    Try assigning a value, which I.E. expects:
    Code:
    for (i=0;i<=rec_count;i++) // "<=" ?
    {
      objOption = document.createElement('option')
      objOption.text = ITEM[i];
      objOption.value = ITEM[i];
      newDDL.options.add(objOption);
    }

  • Users who have thanked Calvert Tripesi for this post:

    korssane (08-17-2011)

  • #3
    Regular Coder
    Join Date
    Jun 2011
    Posts
    148
    Thanks
    18
    Thanked 0 Times in 0 Posts
    Thank Calvert ,

    That did the job. i completely did not see that one.

    thanks again


  •  

    Posting Permissions

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