I'm trying to append something to a fieldset
but ajax cannot find the parent of the button.
<fieldset id="asd">
<legend>Export Model</legend>
@Html.Label("Name") @Html.TextBox("name")
<button onclick="addCategory()" type="button">Add Category</button>
</fieldset>
function addCategory() {
$(this).parent().append("test");
}
I saw this example all over the site but it's not working for me. What did I miss?
Change your html like this:-
And then in function:-