Double-click Select to remove an item ondblclick= "This.removechild (This.options[this.selectedindex])"
It does not have to be defined on option. The code is as follows:
<select style= "width:400;height:300;" multiple= "true"
ondblclick= "This.removechild (This.options[this.selectedindex])" >
<option value= "AAA" >aaa</option>
<option value= "AAA" >bbb</option>
<option value= "AAA" >ccc</option>
<option value= "AAA" >ddd</option>
<option value= "AAA" >eee</option>
</select>
//////////////////////////////////////////
//easyui-combobox linkage
<input id= "cc1" class= " Easyui-combobox "data-options="
Value: ' Please select ... ',
Editable:false,
Valuefield: ' Catcode ',
TextField: ' Desc1 ',
URL: ' ${pagecontext.request.contextpath}/coupon/couponitemlist ',
Onselect:function (rec) {
var url = ' ${pagecontext.request.contextpath}/coupon/couponitemlist2?cat= ' +rec.catcode;
$ (' #cc2 '). ComboBox (' reload ', url);
} "
<input id=" CC2 "class=" Easyui-combobox "data-options=" value: ' Please select ... ', Editable:false, Valuefield: ' ItemCode ', TextField: ' Desc1 ', onselect:function (row) {
var opts = $ (this). ComboBox (' Options ');
var Desc1=row[opts.textfield];
var Code=row[opts.valuefield];
var showstring= ' <option value= ' +code+ ' > ' +desc1+ ' </option> '
<!--$ (' #select1 '). Append ( showstring);-->
Sll (desc1,showstring)
} ";
<select ondblclick= "This.removechild (This.options[this.selectedindex])" Multiple id= "Select1" style= "width : 300px;height:200px; ">
<option value= "Test Removal" > Test removal </option>
Judging the contents of Select1, there are duplicates not added, in CC2 reference this function select (desc1,showstring)
function SLL (desc1,showstring) {
var Sell=document.getelementbyid (' Select1 ');
if (sell.length==0) {$ (' #select1 '). Append (showstring); alert ("First");}
else{
Alert ("Already available" +sell.length);
var qq= "Ture"
for (Var i=0;i<sell.length;i++) {
if (Desc1==sell.options[i].text) {
Qq= "false";
Alert (desc1+ "This option is selected and cannot be selected repeatedly");
Return
}
}
if (qq= "Ture") {
$ (' #select1 '). Append (showstring);
}
}
}
Easyui-combobox and select control linkage && Assignment notebooks