-2
4

2 に答える 2

2
$(document).on("click", "a.trigger", function(event){
    event.preventDefault();
    var anchor = $(this);
    var id = anchor.closest("li").attr("id");
    console.log(id);
});

実行例: http://jsfiddle.net/nRaa4/

于 2013-02-26T16:10:18.147 に答える
1
$('.trigger').on('click', function(e) {
    e.preventDefault();
    var ID = $(this).closest('li').attr('id');
})
于 2013-02-26T16:09:26.937 に答える