Answer the question
In order to leave comments, you need to log in
How to open a modal window in a specific tab after the page is loaded?
There is a modal window and the following links leading to different tabs of the modal window:
<a href="#autorizeTab" class="btn btn-warm" data-toggle="modal" data-target="#generalModal">Войти</a>
<a href="#registerTab" class="btn btn-warm" data-toggle="modal" data-target="#generalModal">Регистрация</
<div class="modal" id="generalModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div role="tabpanel">
<ul class="nav nav-tabs" id="referenceTab">
<li class="nav-item">
<a class="nav-link active" href="#autorizeTab" data-toggle="tab">Вход</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#registerTab" data-toggle="tab">Регистрация</a>
</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane show active" id="autorizeTab">
@include('layouts.components.modalComponents.autorizeModal')// строка для шаблонизатора
</div>
<div role="tabpanel" class="tab-pane" id="registerTab">
@include('layouts.components.modalComponents.registerModal')// строка для шаблонизатора
</div>
</div>
</div>
</div>
</div>
</div>
</div>
$(document).ready(function() {
@if($errors->has('reg_error'))// строка для шаблонизатора
$('.nav-tabs a[href="#registerTab"]').tab('show');
@elseif($errors->has('auth_error'))// строка для шаблонизатора
$('.nav-tabs a[href="#autorizeTab"]').tab('show');
@endif// строка для шаблонизатора
});
Answer the question
In order to leave comments, you need to log in
well, then you switch tabs, but where do you actually have $('#generalModal').modal('show') ?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question