elclanrs / jq-idealforms-old

The ultimate framework for building and validating responsive HTML5 forms.
665 stars 95 forks source link

Get Current Tab #144

Closed ewanmc closed 11 years ago

ewanmc commented 11 years ago

Hi, I may be missing how to do this, but is there a way to get the current tab (number or id). I want the submit button to be hidden unless you are on the last tab, and the next tab to be hidden if you are on the last tab. Is there an easy way to do this? I want to check what the next tab number is as the next button is clicked and hide/show buttons as appropriate, but I can't figure out the method to get the tab number. Thanks a lot, great plug-in!

elclanrs commented 11 years ago

Hide the submit button in CSS first then try this:

$('#myform .ideal-tabs-tab').click(function() {
  $('#submit').hide();
  if ($(this).is(':last-child')) $('#submit').show();
});

The current tab gets a class ideal-tabs-tab-active so you can use that to your advantage.

ewanmc commented 11 years ago

Thanks a lot! I should have thought of using last-child, but it was the active class I was looking for. Cheers.