私はドロップダウンリストを持っています:
@Html.DropDownList("name", (IEnumerable<SelectListItem>)SlotList[counter], new { id = "slotDDL_" + @item.ResourceID, tid = @item.ResourceID, @class = "slotDDL_ text white" })
および CheckboxFor:
@Html.CheckBoxFor(modelItem => item.IsSelected, new { @class = "boxcheck_", id = @item.ResourceID })
これを実行すると:
$('.slotDDL_').change(function () {
var resId = $(this).attr("tid");
IsSelected = 'boxcheck_' + resId;
alert($('#' + resId).attr("checked"));
});
私は次のようになります:
alert($(this).attr("tid"))====>505
alert(IsSelected)====> boxcheck_505
alert($('#' + resId).attr("checked"))===>undefined
質問: Id の文字列を正常に作成するにはどうすればよいですか? 私は何を間違っていますか?