-4

javascriptでテキストエリアを更新した後に値を取得する方法は?

document.getElementById("txtArea").innerHTMLドットは更新された値を示します。

<p>
    <textarea style="width:270px;height:100px" id='txtData' rows='3' cols='80'></textarea>
</p>
<p>
    <button type=button style="width:270px;height:40px" onclick="getValue();" id='btnGet'>Get</button>
</p>


<script type="text/javascript">
function getValue () {
        alert(document.getElementById("txtData").innerHTML);
    }
</script>

前もって感謝します。

4

1 に答える 1

2
document.getElementById("txtArea").value; //value of textarea
于 2013-07-15T15:48:15.957 に答える