对于一个正常的输入字段,我可以编写类似下面的代码,这将删除输入字段的默认值,当我点击,如果我不写任何东西在输入字段,比当我离开输入字段时,默认值将会返回。CKEditor on focus删除默认值
jQuery('input[type="text"]').focus(function()
{
if (this.value == this.defaultValue)
{
this.value = '';
}
if(this.value != this.defaultValue)
{
this.select();
}
});
jQuery('input[type="text"]').blur(function()
{
if (this.value == '')
{
this.value = this.defaultValue;
}
});
但我不知道如何用CKEditor做到这一点..我可以得到一些帮助。
我发现这个代码,当我点击CKEditor时会发出警报。但我不知道如何修改它以按我需要的方式工作。
CKEDITOR.instances['post_content'].on('focus', function()
{
alert(1);
});
this.value is undefined for me – Gowri