targetTD[6].find('textarea').text()
がと言っている行に誤りがあるtargetTD [6] .findは関数ではありません。私は<td><div> <textarea readonly> some text </textarea><div><td>
内のテキスト領域を見つけようとしていますカントがtdの子である要素textareaを見つけよう
$(document).ready(function() {
$(document.body).on('click','.edit',function() {// use button class ince ID has to be unique per button
var targetTD;
if($(this).find('i').hasClass('glyphicon-edit'))
{
targetTD = $(this).parents('tr').find('td'); // gives all TDs of current row
if (targetTD[6].firstChild.children.length) // the value cell is what we want
{
// targetTD[6].firstChild.children.item().setAttribute('readonly','false');
alert(targetTD[6].find('textarea').text());
}
( 'targetTD [6] .find(' テキストエリア ')' で、 'targetTD [6] .find' 未定義です)。 readonly
プロパティを削除するにはどうすればよいですか?なぜ私は見つけることができません?
targetTD[6].find('textarea').text();
をして:
$(targetTD[6]).find('textarea').text();
targetTDが包まれていない要素を持つ配列ですので
は '$(targetTD [6])find'を試してみてください。あなたはDOMオブジェクト上でjQuery関数を呼び出そうとしています。 – Tibrogargan
素晴らしい!ありがとう。私の足はまだJQueryとDOM Stuffで濡れています – marc
関連するHTMLコードを追加してください。 –