Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7732555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:45:35+00:00 2026-06-01T06:45:35+00:00

I have a JS file with a simple function, matching width\heights of divs. How

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:45:36+00:00Added an answer on June 1, 2026 at 6:45 am

    If you write your MatchHeights(d1,d2){ ... } function in a JS file and link the file in your HTML page like you normally would link any JS file, then you can call the function in 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 JS files, as long as the original containing file is loaded before the other ones by the browser.

    To get the function to run the moment the page loads, call the function in the onload event of the body tag:

    <script type="text/javascript">
    var div1 = (some code to get the element)
    var div2 = (some code to get the element)
    </script>
    ...
    ...
    <body onload="matchHeight(div1,div2)">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple function to create a gzip file. This function work fine
i have a SWF file with a simple function that returns a string. can
I've written this very simple function to replace a file extension using LINQ in
I have a PHP file with one simple echo function: echo 'アクセスは撥ねりません。'; but when
A really simple shell script question. I have a file with something like this:
I have a simple function GetPageName(String PageFileName, String LangCode) defined inside a class file.
I have a simple JavaScript file, color.js , and a matching spec file, colorSpec.js
I'm having problems trying to call a Javascript function from an enqueued javascript file
I have a simple function that I want to call in the code behind
I have a simple file transfer application, which transfers 4096 bytes per write from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.