First change the handler onto use changeas
$("input").on("change", function() {
$("#output").text($(this).val());
});
Secondly, manually activate it in the click handler, for example
$("button").click(function() {
$("input").val(1);
$("input").trigger("change");
});
fiddle
source
share