Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- calling & defining functions using funcName() vs. window['funcName']()


sssweb - 4:50 pm on Jan 7, 2013 (gmt 0)


I'm using jQuery & jQueryUI (w/some basic plug-ins). Besides that, there's just the text effect scripts; but I don't think they qualify as libraries (they all run on jQuery). There's no MooTools or script.aculo.us or anything.

You're right that it's an issue with the '$' var only; I ran alerts on that and on a generic var -- the generic reads fine, but '$' is "undefined".

I get that regardless of whether I use noConflict() on the func def page. But strangely, if I also remove noConflict() from my call file, I get this for '$':

function(a,b){return new e.fn.init(a,b,h)}

Could the problem be due to the fact that I already use your suggestion #2 in my call file? My slideshow, which starts the whole sequence, runs inside:

jQuery(document).ready(function($){...});

and I call it with:

$("#id")....

Also, in the functions I want to run in external files (the ones with the problems we're discussing), I'm using $("#id2").... for my jQuery commands. That's why I need 'var $ = jQuery;' in the first place.

Am I doing something wrong?


Thread source:: http://www.webmasterworld.com/javascript/4533285.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com