Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
266 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?

question from:https://stackoverflow.com/questions/65670891/link-a-href-in-bootstrap-dropdown-menu-does-not-function

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

1 Reply

0 votes
by (71.8m points)

try

href="accounts/logout/" 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...