我可以使用.text()來獲取原始文本,但更新的文本不會被.val()命令抓取。有任何想法嗎?JQuery val()undefined for textarea with variable selector
function submitText(subText){ //import submit button id
var boxID="txtArea_"+subText; //rename so that it is the textArea id
alert(boxID); //Alerts as the correct id
alert($("#".boxID).val()); //still undefined
}
HTML是
<textarea id="txtArea_29__KPIs_0" style="width:100%;">First Comment </textarea>
首先警報返回 「txtArea_29__KPIs_0」,第二個是未定義
謝謝大家。對不起,5年後回到這個東西,慢慢來。 JS中沒有顯示任何錯誤... – mrfish