简体   繁体   中英

Multiple ddslick drop down menus at the same time

If I have one dropdown menu, I can used this "ddData.selectedData.text" to get the text very well. But when I use some drop down menus at the same time (use the same "var ddData" ), then I tried to get the selectedData in each of them, it can no longer recognized the data.

for (var i=0;i<3;i++){
$('#dropdownBasico'+i).ddslick({
data: ddData,
width: 150,
imagePosition: "left",
selectText: "How r u ?",
onSelected: function(data){

                 if(data.selectedIndex >= 0) {
                                  ddData = $('#dropdownBasico'+i).data('ddslick');
                                   alert('Selected text: '+ddData.selectedData.text); //this will give no result !

Any one knows what is wrong here ?

I had a problem with multiple select. I don't know if you have the same problem. I fixed it like this:

$('.your-class').each(function (index, element) {
            $(element).ddslick({
                ... options ...
            });
        });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM