Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
21
rated 0 times [  25] [ 4]  / answers: 1 / hits: 23514  / 13 Years ago, tue, may 24, 2011, 12:00:00

I have the following code :



$('.TopNotificationIcon span').remove();    


Can I replace .TopNotificationIcon with this i.e only span exists inside this specific class.



This is the structure



<div class=TopNotificationIcon><span>xxxxx</span></div>


On click of .TopNotificationIcon, span should be removed.


More From » jquery

 Answers
7

if you have click event for .TopNotificationIcon you can do something like this



$('.TopNotificationIcon').click(function(){
$('span',this).remove();
});

[#92079] Monday, May 23, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dominickmackenziet

Total Points: 583
Total Questions: 101
Total Answers: 117

Location: Saint Lucia
Member since Wed, Feb 8, 2023
1 Year ago
;