Reputation: 43
I want to get selected tabs id only if I click on the tabs not click inside the tabs. How do it using jquery version 1.9.1? fiddle:http://jsfiddle.net/tbEq6/240/
Js:
$(function() {
$( "#tabs" ).tabs();
$("#tabs").click(function(e){
alert($("#tabs .ui-tabs-panel:visible").attr("id"));
});
});
Upvotes: 0
Views: 27
Reputation: 12880
You need to change the element your click handler is attached to to the header of your tab .ui-tabs-anchor
:
$(".ui-tabs-anchor").click(function(e){
alert($("#tabs .ui-tabs-panel:visible").attr("id"));
});
Upvotes: 1