I am 开发者_如何学Gotrying to remove an id, and .live is necessary, the code is below
$('.TS').live('click',function() {
("#"+$(this).attr('id')).remove();
});
The error got from chrome
Uncaught TypeError: Object #first has no method 'remove'
I tried removeId, but the above error message.
Appreciate all help
Thanks Jean
You are calling the remove
method on a string. You should make a jQuery selection using this
:
$('.TS').live('click',function() {
$(this).remove();
});
Try this, although it is an indirect way but it works -
$('.TS').live('click',function() {
$(this).attr('id','');
});
精彩评论