Placeholder for textarea

by AJIEKCEU

HTML

<form class="b-search" action="/search/" method="get">
<input name="q" class="dbPlaceholder" type="text" value="Поиск по сайту" title="Поиск по сайту"/>
 <textarea class="dbPlaceholder1" name="textarea2" title="Что необходимо сделать">Что необходимо сделать</textarea>
                    </form>

JavaScript

var textAreaValue = $("textarea[name=textarea2]").val();
$(function(){
    $('textarea.dbPlaceholder1').bind({
        focus: function() {
            if ($(this).attr('title') == $(this).val()) {
                $(this).val('');
            }
        },
        blur: function() {
            if ($(this).val() == '') {
                $(this).val( $(this).attr('title') );
            }
        }
    });
});

$(function(){
    $('input[title].dbPlaceholder').bind({
        focus: function() {
            if ($(this).attr('title') == $(this).attr('value')) {
                $(this).attr('value', '');
            }
        },
        blur: function() {
            if ($(this).attr('value') == '') {
                $(this).attr('value', $(this).attr('title'));
            }
        }
    });
});