事实上这个属性根本没有什么换行的功能,恩,我是指全浏览器兼容的,你光给Chrome或者Firefox搞一个没什么意义。
尤其针对textarea,不如直接用js来的方便,代码如下:
var placeholder = 'This is a line nthis should be a new line';
$('textarea').attr('value', placeholder);
$('textarea').focus(function(){
if($(this).val() === placeholder){
$(this).attr('value', '');
}
});
$('textarea').blur(function(){
if($(this).val() ===''){
$(this).attr('value', placeholder);
}
});
其中n是换行。
代码来着:http://stackoverflow.com/questions/7312623/insert-line-break-inside-placeholder-attribute-of-a-textarea
如本文对您有用,您的捐赠和留言将是我最好的支持~
如您愿意,请向更多志同道合的朋友们推荐本站,谢谢。
请尊重他人劳动成果。
转载请务必附上原文链接,我将感激不尽。
有什么问题可以 留言或QQ联系我
留言