I'm struggling with the following code snippet
<input id="in" value="50px"/>
<div id="out">this is my output</div>
Could anyone guide me on how to use jQuery to bind the #in
value to the #out
's font-size
?
Considerations:
a) I also require compatibility with the version provided in this CodePen example:
$(function() {
$("#out").css("fontSize", $("#in").val());
$("#in").on("input", function(e) {
$("#out").css("fontSize", $("#in").val());
});
$("#in").val("5px"); // should update the font size!
});
b) The script must handle changes when browser autofills the values.