第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

jQuery事件附加到對(duì)象數(shù)組

jQuery事件附加到對(duì)象數(shù)組

慕標(biāo)琳琳 2021-04-19 10:14:11
我想將一個(gè)事件綁定到選擇元素,其中每個(gè)選擇元素都將其轉(zhuǎn)換為一個(gè)jquery-selectbox元素(https://github.com/marcj/jquery-selectBox)var selectBoxes = [];var selectElements = [];$('.select').each(function (index, element) {    //Instantiates selectbox plugin (https://github.com/marcj/jquery-selectBox)     selectBoxes[index] = new SelectBox($(element), settings = {});    selectElements[index] = selectBoxes[index].getSelectElement(); //gets the particular select element    //Binding a close event to perform some tasks    $(selectElements[index]).bind('close', function (el) {         //Doing something here    });});添加一個(gè)插件:https ://plnkr.co/edit/L3dwtVl4rjn2BKBe43x5 ? p = preview當(dāng)我在選擇框中選擇一個(gè)選項(xiàng)時(shí),上面綁定的jquery事件將觸發(fā)那里存在的許多select元素。就我而言,我有3個(gè)選擇元素,因此觸發(fā)了三次。
查看完整描述

2 回答

?
月關(guān)寶盒

TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超5個(gè)贊

根據(jù)插件文檔,您使此過程變得過于復(fù)雜


嘗試更換所有東西


$('select').selectBox(/* options*/).close(function () {

    alert($(this).val());

});

請(qǐng)注意,該插件似乎沒有維護(hù)很長時(shí)間


查看完整回答
反對(duì) 回復(fù) 2021-04-29
  • 2 回答
  • 0 關(guān)注
  • 154 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)