单击按钮时的Jquery切换元素

时间:2015-07-05 13:12:59

标签: jquery each

我想在为该歌曲按下相应按钮时显示专辑名称和类别元素。我该怎么做呢?这是我目前的jquery。谢谢你的帮助。

$('.song-list-btn').each(function(i, obj) {
    $(this).on('click', function () {

    });
});

foreach (var item in Model)
{
               <button class="song-list-btn" type="button">
                   <span class="fa fa-bars" aria-label="Song Details Menu"></span>
               </button>

                @Html.EditorFor(model => item.AlbumName, new { htmlAttributes = new { @class = "form-control details", @placeholder = "Album Name" } })
                @Html.ValidationMessageFor(model => item.AlbumName, "", new { @class = "text-danger" })

                @Html.EditorFor(model => item.Category, new { htmlAttributes = new { @class = "form-control details", @placeholder = "Category Name" } })
                @Html.ValidationMessageFor(model => item.Category, "", new { @class = "text-danger" })
}

1 个答案:

答案 0 :(得分:0)

您需要的是: 下一个相邻选择器(“prev + next”) http://api.jquery.com/next-adjacent-selector/