Question and answer is powered by AnsPress.io
I want add a class to child of some particular element.But dont want to add the class to the selected element child.
<p><span class=”text”>This is demo1</span></p>
<p><span class=”text”>This is demo2</span></p>
<p><span class=”text”>This is demo3</span></p>
<script> $('p').on('click',function(){ $('.text').not($(this).find('.text')).addClass('hide'); }) </script>