Home > Web Front-end > JS Tutorial > body text

Problems with the alternate use of toggle functions in jquery_jquery

WBOY
Release: 2016-05-16 15:53:36
Original
1474 people have browsed it

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>
Copy after login

js code:

$('.sortBox').on('click', 'a', function () {
$(this).addClass('selected').siblings().removeClass('selected');
}) ;
$('.sortBox a')[0].click();

Copy after login

The above is the entire content of this article, I hope you all like it.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template