Código de JQuery - Ajustar en altura un texarea a su contenido

Imágen de perfil

Ajustar en altura un texarea a su contenidográfica de visualizaciones


JQuery

Publicado el 08 de Febrero del 2016 por xve
1.178 visualizaciones desde el 08 de Febrero del 2016. Una media de 28 por semana
Este simple código muestra como ajustar la altura de un textarea a la altura de su contenido.

Versión 1.0

Actualizado el 09 de Febrero del 2016 (Creado el 08 de Febrero del 2016)gráfica de visualizaciones de la versión: Versión 1.0
1.179 visualizaciones desde el 08 de Febrero del 2016. Una media de 28 por semana
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
	<script type="text/javascript" src="//code.jquery.com/jquery-2.2.0.min.js"></script>
 
	<script type="text/javascript">
	$(document).ready(function() {
		$(".autoHeight").each(function(){;
			$(this).height($(this).prop('scrollHeight'))
		})
	});
	</script>
 
	<style>
	textarea {width:300px;float:left;margin:5px;}
	</style>
</head>
 
<body>
 
<textarea class="autoHeight">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</textarea>
<textarea class="autoHeight">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</textarea>
 
</body>
</html>



Comentarios sobre la versión: Versión 1.0 (0)


No hay comentarios
 

Comentar la versión: Versión 1.0

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios

http://lwp-l.com/s3428