次のコードがあります
<tr class="DataGridAlterItem" align="center">
<td align="center">
<input id="ctl00_PageBody_grdCustomers_ctl117_rdoCustomerSelect" type="radio" name="rdo_ctl117" value="rdoCustomerSelect" onclick="check(this);" class="radio">
</td>
<div class="myDIV">
This is the related text for div###
</div>
私が達成しようとしているのは、TD「名前」(name="rdo_ctl117") の値を同じ行の DIV にコピーすることです。
最終結果は次のようになります
<tr class="DataGridAlterItem" align="center">
<td align="center">
<input id="ctl00_PageBody_grdCustomers_ctl117_rdoCustomerSelect" type="radio" name="rdo_ctl117" value="rdoCustomerSelect" onclick="check(this);" class="radio">
</td>
<div class=""myDIV name="rdo_ctl117">
This is the related text for div###
</div>
クローンを使用してみましたが、入力要素全体をコピーしようとしました...名前属性のみが必要です。
next、prev、siblings なども試しましたが、期待どおりに動作しません。
$('input[name^="rdo_ctl"]').click(function(){
var tblTitle = $(this).attr('name');
$(this).next().prop('title', tblTitle);
});
$('input[name^="rdo_ctl"]').click(function(){
$(this).attr('name',name).appendTo('.myDIV', name);
});
助言がありますか?