Reputation: 3447
I have this code:
$("a[data-action='sale'").on('click', function(){
var target = $(this).attr('href');
StateMaster.togglehorseFilters('for_sale');
});
Basically I am just trying to pre-fire a filter on my forum when a user clicks on it but still take them to the section of the page where the content is.
The hash jump works and then pre-filtering works but the page won't navigate to the hash when I try and piggyback on the click event.
Update:
Some requested to see the togglehorseFilters
method:
togglehorseFilters: function(filter) {
this.state.horseFilters[filter].value = !this.state.horseFilters[filter].value;
this.emit('horse-search-term-visibility-change');
},
Upvotes: 0
Views: 40
Reputation: 4572
You forget the ]
in your selector.
$("a[data-action='sale']").on('click', function(){
var target = $(this).attr('href');
StateMaster.togglehorseFilters('for_sale');
});
Upvotes: 1