移动web端textarea的placeholder提示文字换行,android和ios都适用

参考文章:https://blog.csdn.net/daiqinge/article/details/52799811

$( function() {
var placeholder = 'line1 \n \n line2';
$( 'textarea'). val( placeholder);
$( 'textarea'). focus( function() {
if ( $( this). val() == placeholder) {
$( this). val( '');
}
});
$( 'textarea'). blur( function() {
if ( $( this). val() == '') {
$( this). val( placeholder);
}
});

猜你喜欢

转载自blog.csdn.net/tanqiaoxing/article/details/80755304
今日推荐