css - HTML textarea tag help required -


i have set default value in textarea. want when clicks on textarea default value disappears. whats html code that?

<textarea onfocus="this.value = ''">this default value</textarea> 

this little piece of code responsible:

onfocus="this.value = ''" 

basically when focus event fired, value of current field set empty string ""

of course can make more complexe , make sure erase when element contains default message:

<textarea id="myfield">this default value</textarea> 

javascript:

var defaultmsg = "this default value"; document.getelementbyid("myfield").onfocus = function () {    if (this.value == defaultmsg) {       this.value = "";    } }  document.getelementbyid("myfield").onblur = function () {    if (this.value == "") {       this.value = defaultmsg;    } } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -