i need to display value of <input> into the <span> and when label become empty, change value of span to “Video title”. But always i type something into the <input> and then delete it, the <input> still have “” value so <span> display nothing. Thanks for help. (And sorry for my bad english)
Here is my code:
$("#newVideoName").keyup(function(){
var newVideoName = $("#newVideoName").val();
if(newVideoName == ""){
$("#newVideoNameLabel").html("Video title");
}
});
<input type="text" id="newVideoName">
<span id="newVideoNameLabel"></span>
http://jsfiddle.net/gZPyQ/