When you do this:
$('.showPopover').popover({...
you're creating a popover for each of the elements with the class showPopover
. Which might be fine, but because you are resuing content, especially input elements, you will get them duplicated. So if you run your code and look at the source generated, you will see that you have 2 x input
with id="input1"
. Therefore you are getting issues with the values cross contaminating your destinations.
A fix would be to have separate content for each popover, or to have the onclick
event of the button get the value of the nearest input to find the data to populate.
e.g:
var ctlInput = $(this).siblings("#input1").val();
Here is a codepen demonstrating that: http://codepen.io/simoncowie/pen/lyGoK