Reputation: 35
I have the following definition of an element "tabs" in liferay-ui (using liferay 6.0) in my JSP file.
<liferay-ui:tabs
names="articles,book chapters,books"
refresh="<%= false %>"
param="tab"
url="<someURL>"
value="<%=tab%>"
onClick="clean()"
>
The function 'clean()' makes something I need when the tab changes, but with the onClick, it also activates when the user clicks in the active tab.
Do you know how could I make the distinction between the active tab and the others inside the script or just make it happen when the tab change to a different one?
Thanks in advance,
Luis.
Upvotes: 1
Views: 875
Reputation: 35
Finally, sorted this out using JQuery referring to the class generated for the tabs element (.aui-tabview-list) and checking the class ".current".
$(document).ready(function(){
$(".aui-tabview-list li").click(function(){
var isActualTab = $(this).hasClass("current");
if(isActualTab != true){
//code of the function
}
});
});
Thanks to Parkash for the help.
Upvotes: 1