想要创建链接文本框:
textbox1 textbox2 textbox3
_________ ____________ _____________
|___A____| |(1)disabled| |(a)disabled|
textbox1(value):A,B,C,D,E;
textbox2(value):1,2,3,4,5;
textbox3(value):a,b,c,d,e; like-> "A,1,a","B,2,b"=> this will be the combination
当选择textbox1的值时,textbox1对应的值将出现在textbox2中,就像textbox3 w.r.t textbox3中一样。我的预定义值将存储在jQuery函数中,调用它时将填充该值。
需要建议....
最佳答案
$(".chainbox").on("keyup", function(){
$(".chainbox").val(this.value);
});
<强> DEMO 1
我认为你想要一个选择框
而不是复选框
(不确定)
$(".myselect").on("change", function(){
// here I update value of next select box
// using current selectbox value
// may be you have something else
$(this).next('.myselect').val(this.value).prop('disabled', false);
});
<强> DEMO 2
如果您想将第一个选择的选定文本显示到接下来的两个文本框,则:
$(".myselect").on("change", function(){
$(this).nextAll(':input.mytext').val($('option:selected', this).text());
});
<强> DEMO 3
关于javascript - jQuery 中的链式文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10861690/