I am trying to do a simple hide & show of a DOM on click event.I am showing the loadMenu container on clicking of span#dwnTrigger. But my problem is even when I am clicking on the div#loadMenu , this div#loadMenu is getting hidden. I am not sure how can this happen as the event is attached to span#dwnTrigger.
<span id="dwnTrigger" class="dwnPrint" aria-label="Download" ng-controller="dwnCtrl" > Start
<div class="dwnCtrl menuContainer ng-hide" id="loadMenu">
//rest of DOM
</div>
</span>
Controller
abc.controller('dwnCtrl',['$scope',function($scope){
$scope.$element = $("#dwnTrigger");
($scope.$element).on('click',function() {
if ($("#loadMenu").hasClass('ng-hide')) {
$("#loadMenu").removeClass('ng-hide').addClass('ng-show');
//rest of code
}
else if ($("#loadMenu").hasClass('ng-show')) {
$("#loadMenu").removeClass('ng-show').addClass('ng-hide')
}
})
}]);