On Sharepoint 2013, How to show Delete Link after select on any item using JS link or Jquery? RRS feed

  • Question

  • HI,

    As per the requirement,

    I have to show the Delete Link after select on any sahrepoint list/library item.

    If i click on the Delete link navigate to Justification page.There end user provide justification for Delete that item and click on submit.

    After submitting it,email will trigger to the Admin.

    Let me know how to do this functionality with out Visual Studio/Workflow?

    Wednesday, July 18, 2018 11:30 AM

All replies

  • Hi,

    Sample script to delete selected list item(s) in list view for your reference.

    <script type="text/javascript">
            function deleteSelectedItem() {
                var context = SP.ClientContext.get_current();
                var selectedItems = SP.ListOperation.Selection.getSelectedItems(context);            
                var list = context.get_web().get_lists().getByTitle("ListB");
                var item;
                for (item in selectedItems) {
                    var itemID = selectedItems[item].id;
                    var listItem=list.getItemById(itemID);
                context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
            function onQuerySucceeded() {
            function onQueryFailed(sender, args) {
                alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
        <input id="Button1" onclick="deleteSelectedItem()" type="button" value="button" />

    Per your requirement, you could get the list itemd ID(s) and pass to other page as parameter and then delete.

    Best Regards,


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, July 19, 2018 2:21 AM