$(document).ready(function() { $(document).on("change", "#name", function() { $("#firstname").val( this.value );
Note
Instead of .live() use .on() with jQuery 1.7+ because live() deprecated.
The syntax .on() for handling delegate events is:
$(StaticParent).on( eventName, target, handlerFunction );
Where StaticParent means the non-dynamic parent container of the target element to which you want to bind the event.
So, for the above case, it would be better to use any static parent element #name instead of document .
thecodeparadox
source share