現在のノードの下の1番目の要素のテキスト内容を取得
1541 ワード
checkboxの前のテキストの内容を取得します.
js
<tr id="gridTreeTrid14101" class="" style="" onmouseout="changeClassName(this,'')" onmouseover="changeClassName(this,'GridHighLightRow')">
<td class="GRIDTREESTYLE">
<img border="0" align="absmiddle" src="/images/tree/empty.gif">
<img border="0" align="absmiddle" src="/images/tree/line.gif">
<img border="0" align="absmiddle" src="/images/tree/line.gif">
<img border="0" align="absmiddle" src="/images/tree/join.gif">
</td>
<td>
<input type="checkbox" value="14101" name="salecatIds">
</td>
</tr>
js
function setValue() {
var salecatIds = "";
var salecatNames = "";
$('input:checkbox[name="salecatIds"]:checked').each(function(){
var catId = $(this).val();
var catName = $('#gridTreeTrid'+catId).children().first().text();
salecatIds += catId + ",";
salecatNames += "," + catName;
});
salecatNames = salecatNames.substring(1);
alert(salecatNames);
}