Two things: the change event does not fire until the input loses focus, you probably want to bind the update code to the keyup event. Secondly, although this code updates your div sample , popover just gets this data when popover fires; if you want to update the popover sample div, you need to handle this as part of the keyup event keyup . Try changing this event handler as follows:
$('.validate').keyup(function() { var eval_me = $('.validate').val(); $('#sample').html(eval_me); $('.popover #sample').html(eval_me); });
and you have to be good. Check out the fiddle .
Edit : Actually, playing with it a bit, it seems that keyup is a better trigger than keypress , otherwise the update keeps track of input with one char, but I'm probably just missing something there. Accordingly, I changed the code.
source share