最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - main navigation menu disappear after adding jquery source file

programmeradmin0浏览0评论

I have created a new page on my website: / and added jquery source file :

<script type="text/javascript" src=".js"></script>

which is on 1034 line of code and after that my main navigation menu disappears completely for some reason. The menu is fully visible on other parts of the website. I need to keep that jquery file in order for some other page parts to work for me.

What I can do to keep that Jquery file there and make navigation visible again?

Thanks

I have created a new page on my website: https://membership.gai-edu.eu/country-qualification/ and added jquery source file :

<script type="text/javascript" src="https://code.jquery/jquery.js"></script>

which is on 1034 line of code and after that my main navigation menu disappears completely for some reason. The menu is fully visible on other parts of the website. I need to keep that jquery file in order for some other page parts to work for me.

What I can do to keep that Jquery file there and make navigation visible again?

Thanks

Share Improve this question asked Mar 13, 2020 at 19:43 Boris ŽegaracBoris Žegarac 32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

jQuery is already being included on the page, so you don't need to include it again.

I'm assuming your adding that because you want to run the JS below it?

$(document).ready(function() {
    $("#countryChooser").change(function() {
        if ($(this).val() !== "") {
        var selector = "." + $(this).val();
        $('.box').not(selector).hide();
        $(selector).show();
        } else {
        $(".box").hide();
        }
    }).change();
});

If that's the case, remove the additional call to load jQuery, then change all the $ to jQuery.

For example...

jQuery(document).ready(function() {
    jQuery("#countryChooser").change(function() {
        if (jQuery(this).val() !== "") {
        var selector = "." + jQuery(this).val();
        jQuery('.box').not(selector).hide();
        jQuery(selector).show();
        } else {
        jQuery(".box").hide();
        }
    }).change();
});
发布评论

评论列表(0)

  1. 暂无评论