我有mvc.grid / webgrid和下拉列表。在下拉列表中选择更改事件我只获得第一行下拉列表选择值。选择第二行下拉列表时,只获取第一个下拉列表的值,这是不正确的。
任何人都可以帮助我。
newsArr = ['Item 1','Item 2','Item 3','Item 4'];
$.each(newsArr, function(i) {
$('ul#newsScroller').append('<li class="news-item">' + newsArr[i] + '</li>');
$('#allNewsDiv').append('<div class="all-news-item"><img src="https://dl.dropbox.com/s/r8nu1zb2gpzd92k/Ball%20Icon.png" alt="" style="float:left; margin-right:10px; position: relative; top: 2px;" width="20" height="20"><div class="all-news-item-text">' + newsArr[i] + '</div></div>');
});
// Determine the height of the li element and set the scroller to that height
var maxScrollerHeight = Math.max.apply(null, $('ul#newsScroller li').map(function() {
return $(this).outerHeight(true);
}).get());
$('#newsScroller').css({
'height': (maxScrollerHeight) + 'px',
'opacity': '1'
});
// Hide li elements initially
$('ul#newsScroller li').css({
'display': 'none'
});
(function() {
var newsItems = $(".news-item");
var newsItemsIndex = -1;
function showNextNewsItems() {
++newsItemsIndex;
newsItems.eq(newsItemsIndex % newsItems.length)
.fadeIn(2000)
.delay(2000)
.fadeOut(2000, showNextNewsItems);
}
showNextNewsItems();
})();