jquery focusout not adding text back in -


i have textarea has text in on page load. when clicks on i'd text go away. when click out of it, if haven't typed i'd text come back, if have nothing happen. text 'type answer here". have works removing text on click not adding in if haven't typed anything.

$(".area-3").focusin(function() {      $(".area-3").text(" ");  }).focusout(function() {     if ($(".area-3").val().length == 0) {      $(".area-3").text("type answer here.");     }   }); 

thanks on this.

something :

$(".area-3").on({     focus: function() {        if (this.value == 'type answer here.') this.value = '';     },     blur: function() {        if ( $.trim(this.value) == '') this.value = 'type answer here.';     } }); 

fiddle


Comments

Popular posts from this blog

php - Cakephp Not validating data in Form -

java - RSS Feed Parsing, extracting field value -