溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

怎么實(shí)現(xiàn)jQuery級聯(lián)菜單

發(fā)布時間:2022-03-30 09:55:49 來源:億速云 閱讀:181 作者:iii 欄目:移動開發(fā)

這篇文章主要講解了“怎么實(shí)現(xiàn)jQuery級聯(lián)菜單”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“怎么實(shí)現(xiàn)jQuery級聯(lián)菜單”吧!

層疊樣式表:

.button {
 border: 1px ridge #ffffff;
 line-height:18px;
 height: 20px;
 width: 45px;
 padding-top: 0px;
 background:#CBDAF7;
 color:#000000;
 font-size: 9pt;
}

HTML正文:

<div >
<table width="285" height="169" border="0" align="left" cellpadding="0" cellspacing="0" >
<tr>
<td width="126">
<select name="first" size="10" multiple="multiple" class="td3" id="first">
<option value="選項(xiàng)1">選項(xiàng)1</option>
<option value="選項(xiàng)2">選項(xiàng)2</option>
<option value="選項(xiàng)3">選項(xiàng)3</option>
<option value="選項(xiàng)4">選項(xiàng)4</option>
<option value="選項(xiàng)5">選項(xiàng)5</option>
</select> 
</td>
<td width="69" valign="middle">
<input name="add" id="add" type="button" class="button" value="-->" /> 
<input name="add_all" id="add_all" type="button" class="button" value="==>" />
<input name="remove" id="remove" type="button" class="button" value="&lt;--" />
<input name="remove_all" id="remove_all" type="button" class="button" value="&lt;==" />
</td>
<td width="127" align="left">
<select name="second" size="10" multiple="multiple" id="second">
<option value="選項(xiàng)6">選項(xiàng)6</option>
</select>
</td>
</tr>
</table>

Javascript操作代碼:

$(document).ready(function(){

$("#add").click(function(){
 $("#first option:selected").appendTo($("#second"));
});

$("#add_all").click(function(){
 $("#first option").appendTo($("#second"));
});

$("#remove").click(function(){
 $("#second option:selected").appendTo($("#first"));
});

$("#remove_all").click(function(){
 $("#second option").appendTo($("#first"));
});
});

效果:

怎么實(shí)現(xiàn)jQuery級聯(lián)菜單

感謝各位的閱讀,以上就是“怎么實(shí)現(xiàn)jQuery級聯(lián)菜單”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對怎么實(shí)現(xiàn)jQuery級聯(lián)菜單這一問題有了更深刻的體會,具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識點(diǎn)的文章,歡迎關(guān)注!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI