I want to add a class .filter_open to my element id #block_filters when click in #filter-button a element so here is my HTML:
<a id="filter-button" >Show filters</a>
<div class="block_content" id="block_filters" >
</div>
Here my .js
function open_filters() {
var f_toggle = $('#filter-button');
var f_content = $('#block_filters');
f_toggle.on('click', function(e) {
f_content.addClass('filter_open');
e.stopPropagation();
e.preventDefault();
});
}
But It's not working, I can't find the reason.
Thanks for your help
Edit:
I am also testing this way, but no luck
$(document).ready(function ()
{
$('#filter-button').click(function () {
$('#block_filters').addClass('filter_open');
});
}