Jump to content

Global Variables File?


atrum

Recommended Posts

yeah, just create a js file with your global vars and include it on every page.

 

It would probably be best to wrap your vars in a namespace so that you ensure they aren't overwritten

var atrum_app = {
    var_1: 'some value',
    var_2: 'value'
};

//usage

atrum_app.var_1; //some value

So, say for example that I have 10 txt fields on a form, and I have other forms with the same naming conventions.

 

If I wanted to declare those txt fields in a global array, then include them on each page that I used those names. Then I can use them on any function, so long as I include that file. Correct?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.