所以我在这HAML简单的菜单,是为了被标签选项卡之间切换功能不起作用与jQuery
.monthly_tab#selected
Monthly
.yearly_tab#notselected
Yearly
这是jQuery代码标签之间切换。它不能完全正确地工作。我可以从.monthly_tab切换到.yearly_tab,但不能返回。
$(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()
}
});
});对于标签