tags:

views:

300

answers:

1

hello everyone,

Please look at this code:

jQuery(document).ready(function(){
     jQuery("td.setting").click(function(){
       text = jQuery(this).text();
       jQuery(this).replaceWith("<input class='inputSetting' type='text' value="+text+"><img class=\"accept\" src='images/accept.png'>");
       console.log(text);
     });
     jQuery("img.accept").bind('click',function(){
       console.log("blur");
     });

    });

When I press on the td. The input box appears. But when I clcikc on the accept img nothing happens. There should be amessage on my console "blur" but nothing happens.

I also tried:

jQuery("img.accept").click(function(){
           console.log("blur");
         });

But this also doesn't work.

+1  A: 

Try using live instead of bind for the image.

DLH
it really works with jQuery("span.accept").live('click',function(){ console.log("blur");});
Alex Pavlov