I am still new to JQuery but what I am trying to do is this:
Click my edit button and call someFunction()
Jquery then will hide my edit button, show my save button, and hide the delete button.
Get the item.ID and save as a var for later.
Here is my attemp thus far.
The button set:
<td class="col-lg-3 col-lg-offset-1">
<span style="visibility:hidden">@Html.DisplayFor(modelItem => item.ID)</span>
<span class="item-edit-button">
<button type="button" onclick="someFunction()" class=" btn btn-warning col-lg-4"><span style="margin-right: 5px" class="glyphicon glyphicon-pencil"></span>Edit</button>
</span>
<span class="item-save-button">
<button type="button" class="btn btn-success col-lg-4"><span style="margin-right: 5px" class="glyphicon glyphicon-trash"></span>Save</button>
</span>
<span class="item-delete-button">
<button type="button" class="btn btn-danger col-lg-4" onclick="location.href='@Url.Action("Delete", "Movie", new { id = item.ID })' ;return false;"><span style="margin-right: 5px" class="glyphicon glyphicon-trash"></span>Delete</button>
</span>
</td>
my JQuery attempt (without getting the var since I haven't gotten to that point yet)
<script>
function someFunction() {
someFunction //trying to get current item/value/button/ect..
.hide()
.next("span.item-save-button")
.show()
.next("span.item-delete-button")
.hide()
};
</script>
EDIT: How to do this using the answer below
function someFunction(element) {
$(element).hide();
$(element).closest("td").find("span.item-save-button").show();
$(element).closest("td").find("span.item-delete-button").hide();
}