I'm struggeling with some code, I have code to when I click a <p> element it changes the iframe src and removes the class 'active' of all the elements in the .html file and then add the class 'active' to the clicked element.
But the class 'active' never gets added to the clicked element.
JAVASCRIPT
function loadIframe(url){
$('.iframe_settings').attr('src', url);
$('.nav li').removeClass('active');
$(this).addClass('active');
};
HTML
<li class="w-100" id="http://whatever.com/" onclick="return loadIframe(this.id);">
<p>
<i class="fa fa-id-badge" aria-hidden="true"></i>
<span class="nav-label">Intranet</span>
</p>
</li>
thisand you'll get the answer why...thisin function and use it for add/remove class.