我有一个5行的文本区域。我只想显示一行,在焦点上,它应该显示其余4行。
发布于 2010-12-11 22:28:25
您可以尝试如下所示:
$(document).ready(function(){
$('#moo').focus(function(){
$(this).attr('rows', '4');
});
});
其中moo是你的文本区域。
发布于 2010-12-11 22:24:50
jQuery(function($){
$('#foo').focus(function(){
$(this).attr('rows',5);
}).blur(function(){
$(this).attr('rows',1);
});
});
或者,使用更少的jQuery,更少的输入,并获得更高的性能:
jQuery(function($){
$('#foo')
.focus(function(){ this.rows=5 })
.blur( function(){ this.rows=1 });
});
发布于 2012-06-21 08:53:54
尝尝这个
$('#textboxid').focus(function()
{
$(this).animate({'height': '185px'}, 'slow' );//Expand the textarea on clicking on it
return false;
});
https://stackoverflow.com/questions/4417161
复制相似问题