Reputation: 1009
I am trying to hide a div with jquery when an element is clicked. Currently I have the below code which doesn't seem to work.
$('#tabTwo').hasClass('current', function() {
$(".featuredNews").css('display','none');
});
I should only do this when a tab with an id has a class as well as I need to do a few thing with this.
How can I solve this?
Thanks,
Sat
Upvotes: 0
Views: 98
Reputation: 1009
I did it like this to add a class which was set to display:none
$('#tabTwo a').click(function() { $("#tabOne").addClass('borderStrip'); });
Thanks for all the help
Upvotes: 0
Reputation: 338148
$('#tabTwo.current').click(function () {
$(".featuredNews").hide();
});
If the .current
class can be added or removed dynamically, use live()
$('#tabTwo.current').live("click", function () {
$(".featuredNews").hide();
});
Upvotes: 2