children() - how to use properly?
Hi,
I've come up a bit of a blank on this one. The below works:
- $('a.want_rec').each(function() {
-
- if ($(this).attr('rel') == this_user_id) {
- $(this).removeClass("do_follow");
- $(this).removeClass("btn-warning");
-
- $(this).addClass("remove_following"); // make sure we do this so we can now remove them if we want!
- $(this).addClass("btn-danger");
-
- $(this).siblings().removeClass("icon-minus").addClass("icon-plus");
-
- }
-
- });
With the exception of:
- $(this).siblings().removeClass("icon-minus").addClass("icon-plus");
The HTML structure is:
- <a href="#" class="want_rec" rel="1234">
- <b class="icon-minus icon-2x"></b>
- </a>
What I need to do, is loop through each of those elements, and replace them with the icon-plus class. I've tried a few variations:
- $(this).siblings('b').removeClass("icon-minus").addClass("icon-plus");
- $(this).children().removeClass("icon-minus").addClass("icon-plus");
Yet none of them seem to work. Anyone got any ideas? I'm banging my head against the wall on this one!
TIA
Andy