我像这样构建下拉列表
var jsonData = [
{
text: "Facebook",
value: 1,
description: "Description with Facebook",
image: "http://dl.dropbox.com/u/40036711/Images/facebook-icon-32.png"
},
{
text: "Twitter",
value: 2,
description: "Description with Twitter",
image: "http://dl.dropbox.com/u/40036711/Images/twitter-icon-32.png"
}
];
var jsn = $("#byjson").msDropDown({byJson:{data:jsonData, name:'payments'}}).data("dd");
我想获得选定的值,我尝试了这样的代码
$("#byjson").change(function () {
var selectedIndex = $(this).val();
alert("value =" + selectedIndex);
});
当我从下拉列表中选择某些内容时,我总是将值设为空白。我无法获得选定的值。我究竟做错了什么?