【问题标题】:Jquery toggle elements when button is clicked单击按钮时Jquery切换元素
【发布时间】:2015-09-22 16:56:54
【问题描述】:

我想在按下该歌曲的相应按钮时显示专辑名称和类别元素。我该怎么做呢?这是我目前拥有的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" })
}

【问题讨论】:

    标签: jquery each


    【解决方案1】:

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

    【讨论】:

    • 我给你链接到带有示例的文档。你没有给html
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-10
    • 2015-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多