$('textarea').focus(function() {
var img = $(this).css('background-image');
$(this).css('background-image', 'none');
});
$('textarea').blur(function() {
$(this).css('background-image', img);
});
.. doesn’t seem to work. I think somethings wrong, but I can’t figure out what.
Many thanks for your help!
If you define
just inside the
.focus()event handler, that variable will not be available within.blur()So either define
var imgglobaly, or use jQuerys.data()method for instance.write:
read:
example: