2013-01-22 18 views
0

纯jQuery的版本:如何获得组合框的最后更改的选项的值

$('select#register-type').live('change', function() { 
    console.log($(this).val()); 
}); 

骨干观点代表事件的版本?看来我不能使用$(本),如jQuery的版本,这被称为寄存器视图对象...

+1

“选择登记#型” < - 仅供参考在这里没用。如果您通过ID查找元素,则ID本身就足够了。 –

回答

1

使用event.target

type: function (event) { 
    $(event.target).find('option:selected').val(); 

     **OR** 

    $(event.target).val(); 
} 
相关问题