Quick answer: To add a jQuery tabs next prev button, put Next and Previous buttons inside each Bootstrap tab pane and, on click, trigger the next or previous tab link with jQuery. This turns tabs into a simple multi-step form. A Bootstrap 5 version without jQuery is included below.
Table of Contents

What the jQuery tabs next prev button code does
It lets visitors move through Bootstrap tabs with Next and Previous buttons instead of clicking the tab titles. This turns a long form into simple steps, for example contact details, project requirements and a final confirmation, which usually improves completion rates.
Step 1: Tabs and buttons HTML
Each tab pane gets its own Next and Previous buttons with the classes btnNext and btnPrevious. This markup uses Bootstrap 4 pills.
<ul class="nav nav-pills nav-fill mb-3" id="pills-tab" role="tablist">
<li class="nav-item"><a class="nav-link active" data-toggle="pill" href="#step-1" role="tab">Your information</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="pill" href="#step-2" role="tab">Requirements</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="pill" href="#step-3" role="tab">Confirm</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="step-1" role="tabpanel">
<!-- step 1 fields -->
<button type="button" class="btn btn-primary btnNext">Next</button>
</div>
<div class="tab-pane fade" id="step-2" role="tabpanel">
<!-- step 2 fields -->
<button type="button" class="btn btn-secondary btnPrevious">Previous</button>
<button type="button" class="btn btn-primary btnNext">Next</button>
</div>
<div class="tab-pane fade" id="step-3" role="tabpanel">
<!-- summary -->
<button type="button" class="btn btn-secondary btnPrevious">Previous</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
Step 2: jQuery for Bootstrap 4
When a button is clicked, the code finds the active tab link, moves to the next or previous list item and clicks its link, so Bootstrap handles the animation.
jQuery(function ($) {
$('.btnNext').on('click', function () {
$('#pills-tab .nav-link.active').closest('li').next('li').find('.nav-link').trigger('click');
});
$('.btnPrevious').on('click', function () {
$('#pills-tab .nav-link.active').closest('li').prev('li').find('.nav-link').trigger('click');
});
});
Bootstrap 5 version without jQuery
Bootstrap 5 no longer needs jQuery. Change data-toggle to data-bs-toggle in the HTML and use this script instead.
// Bootstrap 5 version (no jQuery). Use data-bs-toggle="pill" in the HTML.
document.addEventListener('click', function (e) {
var btn = e.target.closest('.btnNext, .btnPrevious');
if (!btn) return;
var links = Array.prototype.slice.call(document.querySelectorAll('#pills-tab .nav-link'));
var index = links.findIndex(function (link) { return link.classList.contains('active'); });
var next = btn.classList.contains('btnNext') ? index + 1 : index - 1;
if (links[next]) {
bootstrap.Tab.getOrCreateInstance(links[next]).show();
links[next].scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
});
Tips for multi-step tab forms
- Validate the fields of the current step before moving to the next one.
- Disable the tab titles if users must follow the steps in order.
- Show a progress bar or “Step 2 of 3” text so users know how far they are.
- Keep the submit button only on the last step.
Frequently asked questions
How do I add next and previous buttons to Bootstrap tabs?
Add buttons with btnNext and btnPrevious classes inside each tab pane, then use jQuery (Bootstrap 4) or bootstrap.Tab (Bootstrap 5) to show the next or previous tab when they are clicked.
Can I do this without jQuery?
Yes. The Bootstrap 5 version above uses plain JavaScript and the bootstrap.Tab API.
Does this work with Elementor tabs?
Not directly, because Elementor uses its own tab markup. For Elementor, see my guide to opening an Elementor tab from a link.
Need a custom multi-step form or quote calculator? Get a free quote.
Related guides
- JQuery Set Cookies Popup Setup One Day
- Elementor Open Specific Tab, Toggle or Accordion on Link click
- WordPress Development Cost in 2026: Prices and Hiring Guide
Need help with your own site? Get a free quote or see my recent builds.



