1、<textarea rows="4" placeholder="请输入提醒内容"></textarea>
2、
/**
* @param {Object} id 'cname'
* @param {Object} pointout '请输入收藏夹名称'
*/
function pointoutListener(id, pointout) { //为cname添加单击时间和失去焦点的监听器
var myinput = document.getElementById(id);
addListener(myinput, "click", function(){
var value1 = $('#'+id).val().replace(/(^\s*)|(\s*$)/g,"");
var style = $(this).attr('style');
if (style == '' || style==undefined) {
$(this).attr('style','background:#fff;color:#000;');
myinput.value = "";
}
})
addListener(myinput, "blur", function(){
var value1 = $('#'+id).val().replace(/(^\s*)|(\s*$)/g,"");
if(value1=='' || value1==null){
$(this).attr('style', '');
myinput.value = pointout;
}
})
}
function addListener(element, e, fn){
if (element.addEventListener) {
element.addEventListener(e, fn, false);
}
else {
element.attachEvent("on" + e, fn);
}
}
$(function(){
pointoutListener('cname', '请输入收藏夹名称'); //'cname' '请输入收藏夹名称'
pointoutListener('sname', '输入关键词搜索'); //'cname' '请输入收藏夹名称'
});