Jquery keyup doesn't detect content changes by javascript -


i have code puts content of input fields preview div area:

js

function fieldpreview() { $('.input').on('keyup', function() {     $('#' + $(this).data('id')).html(this.value); }); } 

html

<input class="input" type="text" name="title" placeholder="job title" data-id="title"> <div id="title"></div> 

my issue comes fact 2 of input fields little more complicated. 1 field uses google map autosuggest. when click on autosuggestion link updates text field doesn't update preview in div until modify input manually adding or removing letter.

is there better way in jquery monitor changes in input field? allow me put contents of field div if has been put there javascript rather keyup.

here example of jquery clearing contents of input field not being reflected in div: http://jsfiddle.net/xda9p/5/

use change paste keyup input events.

$('.input').on('change paste keyup input', function() {   $('#' + $(this).data('id')).html(this.value); }); 

Comments