Tema: problemas
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/03/2012, 10:15
alex_ore
 
Fecha de Ingreso: marzo-2012
Mensajes: 2
Antigüedad: 12 años, 2 meses
Puntos: 0
Pregunta problemas

Hola que tal! tengo un problema al hacer el siguiente código.... el problema es cuando uso el .html() y lo creo un li y lo agrego se pierde el evento alguien podría ayudarme estaré agradecido:

<!DOCTYPE html>
<html>
<head>
<style>
div { color:blue; font-size:18px; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div id="nav2">
<ul id="2">
<li><a href="#" >Inicio</a></li>
<li><a href="#" >Prductos</a></li>
<li><a href="#" >Catalogo</a></li>
</ul>
</div>

<button id="nombre" name="" title="nose" >Gen valor</button>

<script>
$(document).ready(function(e) {
$("#2 li a").click( function (e)
{
alert('Funciona el evento');
$("#nav2").html( function (index, html) {
return "<ul id='2'> <li><a href='#'>Precios</a></li><li>" +
" <a href='#' >El mas vendido</a></li> <li><a href='#' >Mi carrito</a></li></ul>";
}) ;

e.preventDefault();
}
);


);
});
</script>
</body>
</html>