JQuery: How to make current tab unclickable
I'm a JQuery novice, have no programming langua开发者_运维知识库ge experience so I'm not sure what should I change in this script to make the "current" tab unclickable
The script:
//When page loads...
$(".thumbCategory").hide(); //Hide all content
$("ul.tabsCont li:last").addClass("current").show(); //Activate last tab
$(".thumbCategory:last").show(); //Show last tab content - cause using right float -reversing
//On Click Event
$("ul.tabsCont li").click(function() {
$("ul.tabsCont li").removeClass("current"); //Remove any "active" class
$(this).addClass("current"); //Add "active" class to selected tab
$(".thumbCategory").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
Thank you so much!
You can add a click handler that does event.stopImmediatePropagation() and returns false. You can also set the element to disabled
You can use the class .ui-state-disabled
精彩评论