Click here to Skip to main content
14,881,887 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I think this may be easy, but I am new to it. I am making a web application using express and nodeJS where I want to use
npm install leader-line
in my frontend app.js. I can use the script on server/app.js but I will not be able to access the elements by using document.. The problem is, how do I import leader-line into my frontend app.js

This is my javascript at frontend.

function Start() {
     if(title === 'Tournament brackets')
        {
            let parent;
            let child;
            for (let base = 1; base < 5; base++) {
                let half = 1;
                for (let index = 1; index < 17; index++) {
                    parent = "parent" + index + "" + base;
                    if (index % 2 != 0) { 
                        while ( half <= Math.ceil(index / 2)){
                            child = "parent" + half + "" + (base + 1);
                            half++;
                        }
                    }
                    // Uncaught ReferenceError: LeaderLine is not defined
                    new LeaderLine(
                        document.getElementById(parent),
                        document.getElementById(child)
                    );
                }
            }
        }

For more references on LeaderLine.

Yes, I saw this but I am not sure how to implement it.

Thanks!

What I have tried:

I cannot use document. in app.js on server side.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900