2010-12-11 12 views

Respuesta

25

Usted puede intentar algo como esto:

 $(document).ready(function(){ 

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

donde moo es su área de texto.

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

O, usando menos jQuery, escribir menos, y conseguir un cabello más rendimiento:

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

probar este

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

: Por favor ser más descriptivo acerca de su solución. Consulte: [Cómo responder] (http://stackoverflow.com/questions/how-to-answer) – askmish

Cuestiones relacionadas