I am working with asp.net MVC. I am trying to show a custom message to a user when he clicks a button.

Here is the view : 

```
@foreach (var item in Model.ticketList)
 {
var number = item.TicketId.ToString();
<tr>
    <td>

       @Html.ActionLink(number, "Details", new {id=item.TicketId })
    </td>
    <td>Title : 
        @Html.DisplayFor(model => item.Title)
    </td>
    <td> Date Submitted : 
        @Html.DisplayFor(model => item.DateCreated)
    </td>
    <td id="status"> Ticket Status : 
        @if (item.Status == "open") 
        {
            <span id="open">Open</span>
            @Html.ActionLink("Close","Close",new {id=item.TicketId})
        }
        @if (item.Status == "closed") 
        {
             <span id="closed">Closed</span>
            @Html.ActionLink("Open","Open",new {id=item.TicketId})
        }
    </td>
</tr>
<tr id="ticket-backcolor">
    <td colspan="4">Description :
        @Html.DisplayFor(model => item.Description)
    </td>
</tr>

```

}

The action link is a action controller to modify the value of a field. That works. What I want to do is to show a confirm window in which i ask the user if he is sure he wants to close/open a ticket.

This is what i have been trying to do so far :

```
<script type="text/javascript">
function alert() {
    confirm("are you sure you want to close this ticket ?");
}
$(function () {
    $("span[id='open']").click(alert)
});
</script>

```

And the same for the open option. This does not work. Can someone help me ?

Edit :

```
<script type="text/javascript">
$(document).ready(function () {
    $("td[id='status']").click(function () {
        return confirm('Are you sure you want to open the ticket ? ');
    });
});
</script>

<script type="text/javascript">
$(document).ready(function () {
    document.getElementById("closed").click(function () {
        return confirm('Are you sure you want to open the ticket ? ');
    });
});
</script>

```

The second script does not work either.
this script works for the tag. can not get it to work for the 2 span tags.