代码在这里:http://jsfiddle.net/C5mTf/49/ 我不知道为什么。以下代码是否有任何问题?
$("#menu").on('click','li',function (){
var current = $(this).text();
$('li.top').text('Sort: ' + current);
$('.item').hide();
});
答案 0 :(得分:2)
代码正常运行:
$( document ).ready(function(){
var first = $(this).find("li").eq(1);
$('li.top').text('Sort: ' + first.text());
$(".top").on("click mouseover", function(){
$('.item').show();
});
$("#menu").on('click', '.item', function(){
$('li.top').text('Sort: ' + $(this).text());
$('.item').hide();
});
});