Hi,
An id must be unique on a page. In your code, every created image as the
same id maybe the problem is here but i'm not sure.

I think the first step is to replace id with a class and see if it works.

You can use the live event gestion if you use jquery > 1.3 (
http://docs.jquery.com/Events/live )
Pierre

2009/6/12 fabrice.regnier <fabrice.regn...@gmail.com>

>
> Hi all,
>
> When i click once on a button, i create one picture on the fly. And so
> on. It works ok.
>
> Then, using livequery, when i click on one of the all created
> pictures, i would like to see it removed. But it appears that only the
> first pic is removed (since all have the same name).
>
> What is my mistake ?
>
> regards,
>
> f.
>
> <JQUERY>
>
> $("#IdButton").click( function() {
>  var pic="<p><img id=\"IdPicture\" name=\"IdPicture[]\" src=\"../
> images/icone_ko_small.png\"/></p>"
>  $(this).before(pic);
> });
>
> $("#IdPicture").livequery('click', function(event) {
>    $(this).remove();
> });
>
> <HTML>
>
> <input type="submit" id="IdButton" class="button">
>

Reply via email to