Reputation: 22050
I am trying 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
Upvotes: 0
Views: 947
Reputation: 5405
Try this, although it is an indirect way but it works -
$('.TS').live('click',function() {
$(this).attr('id','');
});
Upvotes: 0
Reputation: 238065
You are calling the remove
method on a string. You should make a jQuery selection using this
:
$('.TS').live('click',function() {
$(this).remove();
});
Upvotes: 3