Я хочу выделить свои элементы и добавить ссылку с помощью jquery.
Мой код:
@model IEnumerable<Mvc3Demo.Products>
@{
ViewBag.Title = "List";
}
<h2>List</h2>
<script type="text/javascript" src="../../Scripts/jquery-1.5.1.min.js" />
<script type="text/javascript">
$(document).ready(function () {
$('#productList li').hover(
function () {
$(this).css({ 'background': 'green', 'cursor': 'pointer' });
},
function () {
$(this).css('background', '');
}
).click(function () {
window.location = 'Product/Edit/' + $(this).attr('productid');
});
});
</script>
<ul id="productList">
@foreach (Mvc3Demo.Products p in Model)
{
<li productid="@p.ProductsID">
@p.Name
<!--@Html.ActionLink("Bearbeiten", "Edit", "Product", p, null)-->
</li>
}
</ul>
Макет страницы:
<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
</head>
<body>
@RenderBody()
</body>
</html>
JQuery будетобнаружил, что это не может быть ошибкой (я проверил это с помощью firebug)
Ошибка:
Нет ошибок в Firebug, нет выделения и нет ссылки
Пожалуйста, помогите