I want to replace the hard coded string “Categories” with a variable. How can I do that?
Instead of having Categories all the time, the word Categories may be replaced by the value held by a variable id, var id.
$(this).closest('ul').append('<li><input type="hidden" name="Categories.Index" value=' + newValue + ' /><input type="text" value="" name="Categories[' + newValue + '].Name" style="width:280px"/><input type="hidden" value="" name="Categories[' + newValue + '].ID" style="width:280px"/><input type="button" value= "Add" /> </li>');
1 Answer