简体   繁体   中英

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. so when the modal window 2 comes out it must have already a value which is the value of 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 .

I've attached keydown handler, which copies the textbox1 's value and assigns it to textbox2 as you type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM