I am trying to get the div to change the font size and update it on the screen. The following code works but there is a problem when you press a key you need to press another key to register the last key was pressed i dont know want that to happen. How would i make it update as soon as you press a key?
$('#font_size_title').keydown(function() {
var font_size_title = $(this).val();
$('#preview_title').css("font-size",font_size_title);
});
Use the
.keyup()event instead, like this:On
keydownthe value hasn’t gotten the last letter yet, onkeyuphoever, the value has been updated.