0

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.com/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

1 Answer 1

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();
});
3
  • You don't actually have to change all of the $ to jQuery. Should just be able to use: jQuery(document).ready(function($) { and the rest can stay as is. Mar 13, 2020 at 20:31
  • That should work as well Mar 13, 2020 at 20:32
  • thank for help, it worked just fine as per your instructions Mar 19, 2020 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.