So I have this simple menu in haml that is meant to be tabbed
.monthly_tab#selected
Monthly
.yearly_tab#notselected
Yearly
And this is the JQuery code to switch between tabs. It does not work completely correctly. I can switch from .monthly_tab to .yearly_tab, but not back.
$(document).ready(function() {
$("#notselected").click(function(){
if ($("#notselected").hasClass("yearly_tab")){
$(".yearly_tab#notselected").removeAttr("id")
$(".yearly_tab").attr("id", "selected")
$(".monthly_tab#selected").removeAttr("id")
$(".monthly_tab").attr("id", "notselected")
$(".prices.monthly").hide()
$(".prices.yearly").show()
}else if ($("#notselected").hasClass("monthly_tab")){
$(".monthly_tab#notselected").removeAttr("id")
$(".monthly_tab").attr("id", "selected")
$(".yearly_tab#selected").removeAttr("id")
$(".yearly_tab").attr("id", "notselected")
$(".prices.yearly").hide()
$(".prices.monthly").show()
}
});
});