【发布时间】:2012-02-03 12:42:11
【问题描述】:
如何在失去焦点后使用 jQuery(使用 ul li p...)显示文本,并且 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
【问题讨论】:
-
标题很混乱。如果没有内容,为什么要格式化任何内容?
-
我在这里的理解是你想在 texatarea 为空时显示它的内容?目标是什么?
-
令人困惑的问题...也许您需要搜索框之类的东西?如果您集中注意力,搜索文本会在哪里消失,如果此输入中没有任何内容,则搜索文本会再次出现?