I have radio buttons that are defined like this
@foreach (var actionType in partActionTypes)
{
<td>
@Html.RadioButtonFor(x => x.Parts[i].SelectedActionType, actionType, new { name = "partRadio" })
</td>
}
Where I try setting the 'name as "partRadio", (I tried doing @name and Name but neither option worked.
In my JQuery code I have it where a row is cloned after a checkbox is clicked, that code looks like this
$(document).ready(function () {
$('.tr_clone input.part-class').change(function () {
let Id = $(this).attr('id');
let partId = $(this).attr('data-partId');
if ($(Id).is(":checked")) {
// remove cloned row
$("#AllTxt").hide();
$("#editQty").show();
}
else {
var $tr = $(this).closest('.tr_clone');
var $clone = $tr.clone();
$clone.find('td');
$tr.after($clone);
$($clone).find(".part-class").hide();
$clone.find('input[type="radio"]').attr("name", function (el) { return el.name + 'clone' });
$("#AllTxt").show();
$("#editQty").hide();
}
});
});
Where it should just be appending 'clone' to 'partRadio' but instead the HTML is rendering the name as 'name = undefinedclone`
Why is this?