Ver Mensaje Individual
  #4 (permalink)  
Antiguo 12/04/2011, 19:39
RodrigoG
 
Fecha de Ingreso: diciembre-2009
Ubicación: dirname(__FILE__)
Mensajes: 149
Antigüedad: 14 años, 5 meses
Puntos: 11
Respuesta: necesito que las palabras que estan en un div se conviertan en link con jq

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<script type="text/javascript" src="jquery-1.5.2.min.js"></script>
<script>
	$(document).ready(function(){
		$('#texto').keydown(function(){
			var palabras = $(this).text().split(" ");
			var texto = palabras.join("</span><span>");
			$('#div_texto').html('<span>' + texto + '</span>');
			$('#div_texto span').click(function() {
				alert($(this).text());
			});
		});
	});
</script>
</head>
<body>
<table width="500" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td><label for="texto"></label>
    <textarea name="texto" id="texto" cols="45" rows="5"></textarea></td>
  </tr>
  <tr>
    <td><div id="div_texto" style="background-color:#096; color:#FFF;"></div></td>
  </tr>
</table>
</body>
</html> 
Se me ocurre eso, se documenta solo, prueba y nos cuentas :)
__________________
Estreno blog ~ DesarrolladorWeb.cl :)