2010-12-11 2 views

Antwort

25

Sie können so etwas wie dies versuchen:

 $(document).ready(function(){ 

    $('#moo').focus(function(){ 
     $(this).attr('rows', '4'); 
    }); 
}); 

wo moo ist Ihre Textarea.

6
jQuery(function($){ 
    $('#foo').focus(function(){ 
    $(this).attr('rows',5); 
    }).blur(function(){ 
    $(this).attr('rows',1); 
    }); 
}); 

Oder mit weniger jQuery, weniger tippen, und immer ein Haar mehr Leistung:

jQuery(function($){ 
    $('#foo') 
    .focus(function(){ this.rows=5 }) 
    .blur(function(){ this.rows=1 }); 
}); 
0

Versuchen Sie, diese

$('#textboxid').focus(function() 
    { 
     $(this).animate({'height': '185px'}, 'slow');//Expand the textarea on clicking on it 
     return false; 
    }); 
+0

: Bitte beschreibe über Ihre Lösung. Siehe: [Antwort] (http://stackoverflow.com/questions/how-to-answer) – askmish

Verwandte Themen