javascript - JQuery Remove all links inside a <div> that have a particular class except for the one that's clicked -
in jquery, how can remove/disable
or change class
of links inside <div>
have particular class
except 1 clicked? clicked one's class needs changed.
<div class="test"> <div class="link" data-id="1">link 1</div> <div class="link" data-id="2">link 2</div> <div class="link" data-id="3">link 3</div> </div>
in case, if clicked link 1
, i'm trying make link 2
, link 3
disappear or change class, , change class of link 1 nolink
.
how can done. i'm familiar add class, remove class, i'm stuck getting others removed or changed , change clicked 1 class.
something this?
$('.test div').on('click', function () { $(this).removeclass('link') .addclass('nolink') .siblings('.link') .remove(); });
Comments
Post a Comment