其他选择框中的添加/删除选项 [英] add / remove option in other select box
本文介绍了其他选择框中的添加/删除选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有两个选择框,当我在一个selextbox中选择选项时,我想在另一个选择框中添加选项.
如果我在一个选择框中选择2作为值,那么我想在其他选择框中添加2个选项..
并且如果我在一个选择框中选择0作为值,我想删除其他选择框中的所有选项
请在jquery中给出示例
毛利克·沙
我已经尝试过
Hi
I have two selectbox , and when i select option in one selextbox , i want to add option in other select box .
if i select 2 as value in one select box , i want to add 2 options to other select box..
and if i select 0 as value in one select box , i want to remove all options in other select box
pls give example in jquery
maulik shah
I have tried as
on first select box change function,
if value of first box is small then second select box selected value ,
i use
var evalue = $("#childid :first-child").attr("value");
$("#childid option[value='"+evalue+"']").prop('selected',true);
i hope u understood
推荐答案
(" #childid:first-child").attr( value");
("#childid :first-child").attr("value");
(" + evalue + " ).prop(' 已选择',true); 我希望你能理解
("#childid option[value='"+evalue+"']").prop('selected',true); i hope u understood
这篇关于其他选择框中的添加/删除选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文