0

I am trying to set up the Responsive Menu using combined.js a merged library of Jquery Sizzle and jQuery core, it is posted here:

https://pastee.org/erewc

But it's eval function conflicts and produces error when I include it in a page having many scripts loaded already like jQuery(smartWizard) and PrototypeJS.

Error produced is as below:

TypeError: $(...) is null
$('options_2_2').advaiceContainer = 'options-2-container';$('options_2_2').callb...

in combined.js > line 623

It's involving eval function so I have no clue how to resolve it. I don't think jQuery noConflict will work here, still suggestions are welcome.

Vicky Dev
  • 1,893
  • 2
  • 27
  • 62
  • either it should be $('.options_2_2') or $('#options_2_2') depending on whether options_2_2 is a class or an id , thats what i think – Master Yoda Nov 06 '15 at 05:57
  • @BhawinParkeria As I already said PrototypeJS is also loaded and used in the page, the code in the error is of Prototypejs in which `$('some')` means element with id 'some' – Vicky Dev Nov 06 '15 at 05:58

1 Answers1

0

I don't know if it's a temporary fix or permanent solution(time will tell), but I managed to resolve the conflict by putting a condition around the eval function call(in combined.js) like below:

if(t.indexOf("$('options_") == -1) {
  e.eval.call(e, t)
}

As I am sure none of my menu elements have "options_" in their class or id attribute.

So my conflict is resolved for now, but still feel free to post your answers if you have a better and cleaner approach for a permanent solution.

Vicky Dev
  • 1,893
  • 2
  • 27
  • 62