[英]How to get value from one modal window textbox and put it to another textbox in another modal window?
I would like to ask you guys for a little help. 我想请你们帮忙。 I wanted to have my textbox in a modal to have the same value in another textbox in another modal window.
我想让我的文本框在一个模态中在另一个模态窗口的另一个文本框中具有相同的值。 The problem is I don't know how.
问题是我不知道怎么做。 I'm new in using modal windows.
我是使用模态窗口的新手。 Hoping that someone can help me.
希望有人可以帮助我。
Illustration:
Modal window1 Modal Window 2
textbox1 textbox2
*textbox1.value must be equal to textbox2.value upon typing. * textbox1.value在输入时必须等于textbox2.value。 so when the modal window 2 comes out it must have already a value which is the value of Modal window1 textbox1.
所以当模态窗口2出来时,它必须已经是一个值,它是Modal window1 textbox1的值。
Well you can do this: 那么你可以这样做:
$('#textbox1').keydown(function(){
$('#textbox2').val($(this).val());
});
I presume that you have two textboxes with id textbox1
and textbox2
. 我假设你有两个文本框,其中包含id
textbox1
和textbox2
。
I've attached keydown
handler, which copies the textbox1
's value and assigns it to textbox2
as you type. 我附加了
keydown
处理程序,它复制textbox1
的值并在键入时将其分配给textbox2
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.