JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="mytextarea"></textarea>
CSS
#mytextarea {
width:300px;
height:200px;
border:1px solid #000;
background:url('http://img821.imageshack.us/img821/2853/writeus.gif') center no-repeat;
}
#mytextarea:focus {
background:none;
}
JavaScript
function init(text) {
text.data('img', text.css('background'));
var update = function() {
if(text.val() == '') {
text.css('background', text.data('img'));
}
else {
text.css('background', 'none');
}
};
text.focus(update);
text.blur(update);
update();
}
init($('textarea'));