Get the dropdown value and text from dynamic row to two textfield
<p>How if i want get the value and text of the dropdown , and put it in the both textfield..
I only able to get the value, but not the dropdown text.. 
For example, after add row clicked, and dropdown clicked, the value and the text of the dropdown appears in the both textfield. Here is the code</p>

<pre><code>&lt;HTML&gt;
    &lt;HEAD&gt;
    &lt;TITLE&gt; Add/Remove dynamic rows in HTML table &lt;/TITLE&gt;
    &lt;SCRIPT language="javascript"&gt;
    function addRow(tableID) {
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;
        var row = table.insertRow(rowCount);
        var colCount = table.rows[0].cells.length;
        for(var i=0; i&lt;colCount; i++) {
            var newcell = row.insertCell(i);
            newcell.innerHTML = table.rows[0].cells[i].innerHTML;
            //alert(newcell.childNodes);
            switch(newcell.childNodes[0].type) {
            case "text":
            newcell.childNodes[0].value = "";
            newcell.childNodes[0].id = "txt"+rowCount;
            break;
            case "checkbox":
            newcell.childNodes[0].checked = false;
            break;
            case "select-one":
            newcell.childNodes[0].selectedIndex = 0;
            break;
            }
        }
    }
    function deleteRow(tableID) {
        try {
            var table = document.getElementById(tableID);
            var rowCount = table.rows.length;
            for(var i=0; i&lt;rowCount; i++) {
            var row = table.rows[i];
            var chkbox = row.cells[0].childNodes[0];
            if(null != chkbox &amp;&amp; true == chkbox.checked) {
            if(rowCount &lt;= 1) {
            alert("Cannot delete all the rows.");
            break;
            }
            table.deleteRow(i);
            rowCount--;
            i--;
            }
            }
        }catch(e) {
        alert(e);
        }
    }
    function addVal(obj,ob){
        var suf = ob.parentNode.parentNode.rowIndex;
        var txt = document.getElementById('txt'+suf);
        txt.value = obj;
    }
    &lt;/SCRIPT&gt;
    &lt;/HEAD&gt;

    &lt;BODY&gt;
    &lt;INPUT type="button" value="Add Row" onclick="addRow('dataTable')" /&gt;
    &lt;INPUT type="button" value="Delete Row" onclick="deleteRow('dataTable')" /&gt;
    &lt;TABLE id="dataTable" width="350px" border="1"&gt;
      &lt;TR&gt;
        &lt;TD&gt;&lt;INPUT type="checkbox" name="chk"/&gt;&lt;/TD&gt;
        &lt;TD&gt;&lt;INPUT type="text" id="txt0" name="txt"/&gt;&lt;/TD&gt;
        &lt;TD&gt;&lt;INPUT type="text" id="txtt0" name="txtt"/&gt;&lt;/TD&gt;
        &lt;TD&gt;
          &lt;SELECT name="country" onchange="addVal(this.options[this.selectedIndex].innerHTML,this)"&gt;
            &lt;OPTION value="in"&gt;India&lt;/OPTION&gt;
            &lt;OPTION value="de"&gt;Germany&lt;/OPTION&gt;
            &lt;OPTION value="fr"&gt;France&lt;/OPTION&gt;
            &lt;OPTION value="us"&gt;United States&lt;/OPTION&gt;
            &lt;OPTION value="ch"&gt;Switzerland&lt;/OPTION&gt;
          &lt;/SELECT&gt;
        &lt;/TD&gt;
      &lt;/TR&gt;
    &lt;/TABLE&gt;
    &lt;/BODY&gt;
    &lt;/HTML&gt;
</code></pre>
