I am changing the text of an element based on input:
$("input#txtName").keyup(function(){ $(".website-info h3 strong").text($(this).val()); }); $("input#txtUrl").keyup(function(){ $(".website-info h3 small").text($(this).val()); });
It works, but I want to show the default values as soon as the text is empty or the user has not added anything to prevent a space. I tried the condition if... is.(:empty) , but this does not help to call .text , it does not seem to set default values.
source share