Situation:
- On a single webpage I am using Syntax Highlighter and Lightbox 2
- Syntax Highlighter uses JavaScript. Lightbox 2 uses jQuery (version 1.7.2)
- When I run each of the scripts on independently(different pages), it works
- Problem only occurs when I run both on the same page
- On Google Chrome, web page runs perfectly
- On IE 8 I get an error when a part of the lightbox2 function is called
- Error points to jquery1.7.2 file stating method/property not supported by this object
- Code for the exact line of error is: parts = rfxnum.exec(val);
- I inserted an alert() to show me vlaues for both rfxnum and val
- rfxnum=/^([+-]=)?([\d+.-]+)([a-z%]*)$/i
- val = 802
- The crazy thing I discovered is that when I run the two scripts independently the alert shows identical values for rfxnum and val, and yet it runs fine.
- Syntax Highlighter runs fine in all conditions
My Guess: -Syntax Highlighter seems to be interfering w/ values/functions/parameters in jQuery 1.7.2 library. OR some global value that both syntax highlighter and jQuery library reference.
My Question:
- Is there a way to prevent Syntax Highlighter or any other non-jQuery JS script to NOT interact/reference the jQuery lib.
- If the answer is, JavaScript won't reference jQuery libs in the first place, then my question is what are some possible reasons that something like this occurs.
- Alternatively, is there a way to package the jQuery lib and relevant JS functions together so that no other functions could reference any of the functions/variables in the package
I would appreciate any suggestions/insights.