我需要单击按钮值并将其发送到列表框。下面是我的代码,我在代码中间注释我需要获取被单击的按钮的值并将其发送到列表框
<asp:ListBox ID="ListBox2" runat="server"></asp:ListBox>
$(function () {
var count = 0;
$('input[type=button]').on('click', function (e) {
e.preventDefault();
count += 1;
if (count % 2 === 0) {
$(this).css('background-color', '#6FA478');
//I have to get here the value of every click button and send it to listbox
}
else {
$(this).css('background-color', '');
}
});
});