Home > Article > Web Front-end > Problems with the alternate use of toggle functions in jquery_jquery
There are several btn triggering toggle functions in HTML. The function I want to achieve is: when each toggle is clicked, all the counts of other toggle functions will be cleared. I tried removedata but it doesn't work. Is there a better way
Let me give you an example for reference
Please refer to this: jsp page
<li> <label class="labelText">统计类型:</label> <span class="sortBox"> <a href="javascript:;" data-type="subject">按学科统计</a> <a href="javascript:;" data-type="classlevel">按年级统计</a> <a href="javascript:;" data-type="lower">按下级统计</a> </span> </li>
js code:
$('.sortBox').on('click', 'a', function () { $(this).addClass('selected').siblings().removeClass('selected'); }) ; $('.sortBox a')[0].click();
The above is the entire content of this article, I hope you all like it.