I have a JS file with a simple function, matching width\heights of divs.
How can I call this function using attributes from HTML file.
In other words, I want to write a function matchHeight(div1,div2) in an outside file but call it from wherever i want using the divs I want.
The function exists, I just don’t know how to call it the way I want.
Sorry if I didn’t explain myself clearly.
Thanks.
If you write your
MatchHeights(d1,d2){ ... }function in aJSfile and link the file in yourHTMLpage like you normally would link anyJSfile, then you can call thefunctionin any part of your page, as long as you call the function after the linked file has been loaded by the browser.Infact, you could even call it in other
JSfiles, as long as the original containing file is loaded before the other ones by the browser.To get the
functionto run the moment the page loads, call thefunctionin theonloadevent of thebodytag: