Using jquery to implement select Add the effect of background permissions added _jquery

Source: Internet
Author: User

Uh. Actually, it's a very simple thing. Picture of the page

Two lists can be selected more than one,

Achieve the following effects:

1. Double-click any list item in the first list to add it down

2. Double-click any list item in the second list to implement Delete,

2, click on the button to achieve the corresponding function.

HTML code

Copy Code code as follows:

<form name= "Form1" method= "Post" action= "" >
<select id= "Select1" size= "5" Multiple style= "width:100px" >
<option value= > Beijing </option>
<option value= "222" > Shanghai </option>
<option value= "333" > Guangzhou </option>
<option value= "333" > Shandong </option>
<option value= "333" > Changzhou </option>
</select><br/><br/>
<input type= "button" id= "Button1" value= "Add" >
<input type= "button" id= "Button2" value= "Delete" ><br/><br/>
<select id= "Select2" size= "5" Multiple style= "width:100px" >

</select>
</form>

jquery Code
Copy Code code as follows:

<script src= "Js/jquery-1.6.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ ("#select1"). DblClick (function () {$ ("#select1: Selected"). Appendto ($ ("#select2"));
$ ("#select2"). DblClick (function () {$ ("#select2: Selected"). Appendto ($ ("#select1"));
$ ("#button1"). Click (function () {$ ("#select1 option:selected"). Appendto ($ ("#select2"));
$ ("#button2"). Click (function () {$ ("#select2 option:selected"). Appendto ($ ("#select1"));
})
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.