jqueryを使用してスパン要素内にテキストフィールド(1つだけ)の値を取得したいができない。jqueryスパン要素内でテキストボックス値を取得する方法
<span>simple span text
<a class="remove" href="javascript:" title="Remove">x</a>
<input type="hidden" name="word[ids][]" value="this is text">
</span>
input
が、これは動作しますが、常にremove
要素の次の兄弟である場合にはアンカータグ
$(".remove").live("click", function(){
alert ($(this).parent().('input:text').val()); // return undefined
//i just coded below to check whether span itself is getting or not
alert ($(this).parent().attr('tag')); // this also return undefined
if ($(this).parent().is('span'));
alert("parent is span"); // only this works
});
おっと
テストは....疑問、NVMを誤解しました。 –