Hi, im just starting with jQuery and trying to add an element dinamically but i cant append it an event like onClick with a javascript alert.
This is my code (it works):
- //***************** IMG ELIMINAR ***************
- nuevoElemento = document.createElement("img");
- nuevoElemento.className = "img_eliminar";
- nuevoElemento.src = "/imagenes/backend/eliminar.png";
- nuevoElemento.align = "top";
- nuevoElemento.alt = "eliminar";
- nuevoElemento.title = "Eliminar";
- nuevoElemento.style = "float:left";
- // agrego el elemento al div padre
- document.getElementById(nuevoDiv.id).appendChild(nuevoElemento);
I tried something like:
- nuevoElemento.attr = "onClick,javascript:alert('Im here')";
but it was useless, so can anyone help me ?
Sorry for my english
Thanks