-1

I'm new in using modals. I just wanted to ask how can I get a value of a span in a modal window with an id of "span1" and put its value to another modal window that has also a span with an id of "span2"? thanks.

Snake Eyes
  • 16,287
  • 34
  • 113
  • 221
user3563036
  • 29
  • 1
  • 1
  • 6

3 Answers3

1

You can do something like:

var span1val = $('#span1').html();
$('#span2').html(span1val);
gerrytan
  • 40,313
  • 9
  • 84
  • 99
0

Something like this:

$('#span2').text($('#span1').text());

Although you'll obviously need to do this under some event, such as the click of a button.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
0

Use JQuery's .html()

 $('#span2').html($('#span1').html());
Sully
  • 14,672
  • 5
  • 54
  • 79