Reputation: 20429
<div class="form-actions">
<button class="btn btn-primary" id="btn-next">Next</button>
<button type="reset" class="btn">Reset</button>
</div>
$("#btn-next").click(function(event) {
$('#tab li.active').next().find('a[data-toggle="tab"]').click();
});
When Next is pressed, form is submitted. How can I cancel it? demo
Upvotes: 0
Views: 4821
Reputation: 10188
Make it an anchor, not a button:
<a class="btn btn-primary" id="btn-next">Next</a>
Upvotes: 9
Reputation: 69915
Just return false
from the click handler.
$("#btn-next").click(function(event) {
$('#tab li.active').next().find('a[data-toggle="tab"]').click();
return false;
});
Upvotes: 1