Skip to content Skip to sidebar Skip to footer

How To Set The Innerhtml Of Html Drop Down List In Ie

I have one html drop down list and button. when i clic

Solution 1:

Your code worked on my IE11, but not on my IE8.

This worked on my IE8:

<scripttype="text/javascript">functionabc()
{
    document.getElementById('ddl').innerHTML = ''; // clear <select> contentsvar a = document.createElement('option');      // create an <option> elem
    a.setAttribute('value', 'TN_Pulling');         // set 'value' attr val
    a.setAttribute('selected', 'selected');        // set 'selected' attr val
    a.innerHTML = 'TN_Pulling';                    // set <option> contentsdocument.getElementById('ddl').appendChild(a); // append <option> to <select>
}
</script><selectstyle="width:170px"id="ddl"></select><inputtype="button"value="getvalue"onclick="abc()" />

Good Luck.

Post a Comment for "How To Set The Innerhtml Of Html Drop Down List In Ie"