The dropdown menu which is being used is of bootstrap. The code is as below
<li id="changethis" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">LINK</a>
<ul class="dropdown-menu">
<li id="clickme"><a href="#">Link1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</a>
<li>
Jquery code looks like this
$(document).ready(function () {
$('#clickme').on('click', function () {
$('#changethis').removeClass('dropdown');
$(this).addClass('dropdown open');
});
});
On click of Link1, I wish to change the li class to dropdown open. I am not getting any error in my console, but the dropdown class is not changed.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…