私は異なるIDを持つ4つのリンクを持っていますが、どのリンクをクリックするとjqueryに別のIDを割り当てるのですか?どんな指導も高く評価します。ありがとう!jqueryに動的IDを割り当てます
HTML:
<ul class="dropdown-menu">
<li>@Html.ActionLink("Manage Site", "Index", "Site", null, new { @id = "btn0" })</li>
<li>@Html.ActionLink("Manage Segment","Index","Segment", null, new { @id = "btn1" })</li>
<li>@Html.ActionLink("Manage Module & URL", "Index", "Modules", null, new { @id = "btn2" })</li>
<li>@Html.ActionLink("Manage User Role", "Index", "UserRoles", null, new { @id = "btn3" })</li>
</ul>
のjQuery:
$(function() {
$(*assign id here*).click(function() {
$("#loading").fadeIn();
var opts = {
lines: 10, // The number of lines to draw
length: 5, // The length of each line
width: 4, // The line thickness
radius: 10, // The radius of the inner circle
color: '#000', // #rgb or #rrggbb
speed: 1, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false // Whether to use hardware acceleration
};
var target = document.getElementById('loading');
var spinner = new Spinner(opts).spin(target);
});
});
あなたは、動的idで何を意味していますか?あなたは割り当てによって何を意味しますか? – madalinivascu