如果它是空的,我如何在textarea中显示格式化文本?

时间:2012-02-03 12:42:12

标签: jquery haml

如何在焦点丢失后使用jQuery(带有ul ...)显示文本,并且textarea为空,现在当我获得焦点时,我会松开文本,但如果我没有,则如何显示进入什么? 我的“伪占位符”看起来像这样:

$('textarea.hinted').focus(function() {
    console.log('focus');
    $('#textarea-placeholder').hide();
});
$('textarea.hinted').blur(function() {
    console.log('blur');
    $('#textarea-placeholder').hide();
});
$('textarea.hinted').focusout(function() {
    console.log($(this).val());
    if (this.val == '') {
        $('#textarea-placeholder').show(); 
    }
});

HTML

1 个答案:

答案 0 :(得分:0)

$('textarea.hinted').focusout(function() {
    if ($(this).val() == '') {
        $('#textarea-placeholder').show(); 
    }
});

应该有用,

你也应该删除模糊,即使它们实际上是相同的东西(我相信)

相关问题