0

I have a visual force page where I have these two libraries at the top.

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<style type="text/css">

I have another page with two tabs. I included both these pages in another page.Tabs on second page not switching. So I trouble shooted and commented two scripts for libraries.Tabs started working. If I include JQuery.noconflict as shown below, tabs did not switch. How can I make the tabs work without commenting the scripts. Any suggestions???

<script src="https://code.jquery.com/jquery-2.2.4.min.js">
</script>
<script>
if(jQuery) {

    jQuery.noConflict();
         }
</script>


<script src="https://code.jquery.com/jquery-3.1.1.min.js">
</script>
<script>
if(jQuery) {

    jQuery.noConflict();
         }

</script>
6
  • Can you share your code, which can better explain the issue Feb 28, 2017 at 3:27
  • Well it not make any sense, why you are using two jQuery versions? Feb 28, 2017 at 3:28
  • Try with following jQuery noconflict syntax, i.e , j$= jQuery.noConflict( true ) Feb 28, 2017 at 3:32
  • Trying all combinations. I jut used JQuery.noConflict() It did not work. I cant post the rest of the code since it is client specific.
    – SFDC
    Feb 28, 2017 at 4:10
  • Still, I'm confused with one thing, I believe your are using <apex:include> for including two pages into one, In that case, it is not required to be use two different jQuery there, is there any specific need ? Feb 28, 2017 at 4:22

1 Answer 1

1

As per the jQuery documentation, it is not recommended to use two JQuery version on the page, But if you are using then you should initialize the jQuery.noconfict() syntax with a added parameter like jQuery.noconfict(true), Here is the reference:

If for some reason two versions of jQuery are loaded (which is not recommended), calling $.noConflict( true ) from the second version will return the globally scoped jQuery variables to those of the first version.

https://api.jquery.com/jquery.noconflict/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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