Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
316 views
in Technique[技术] by (71.8m points)

html - link (a href) in bootstrap dropdown menu does not function

This issue seems to be ancient and a lot of topics about it. yet none of the solutions are working for me at the moment. I have a header with the user name - which is a dropdown menu. in dropdown list i have a link which refuses to work:

                   <div class="dropdown dib">
                        <div class="header-icon" data-toggle="dropdown">
                            <span class="user-avatar">{{ user }}
                                <i class="ti-angle-down f-s-10"></i>
                            </span>
                            <div class="drop-down dropdown-profile dropdown-menu dropdown-menu-right">
                                <div class="dropdown-content-body">
                                    <ul>
                                        <li>
                                            <a data-target="/accounts/logout/" href="/accounts/logout/">
                                                <i class="ti-power-off"></i>
                                                Logout
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>

Following scripts have been imported:

    <!-- jquery -->
    <script src="{% static 'assets/js/lib/jquery.min.js' %}"></script>
    <script src="{% static 'assets/js/lib/jquery.nanoscroller.min.js' %}"></script>
    <!-- nano scroller -->
    <script src="{% static 'assets/js/lib/menubar/sidebar.js' %}"></script>
    <script src="{% static 'assets/js/lib/preloader/pace.min.js' %}"></script>
    <!-- sidebar -->

    <script src="{% static 'assets/js/lib/bootstrap.bundle.min.js' %}"></script>
    <script src="{% static 'assets/js/scripts.js' %}"></script>

this is bootstrap v4.3.1 in 2020 and bootstrap.bundle is supposed to include popper.js these static imports are related to django, so don't worry they are correct!

According to other similar posts, using the data-target attribute on the href should solve the non-functioning link... but it doesn't.

What i might be missing?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

try

href="accounts/logout/" 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...