Acces js const from html file

if I have an js file with an function and parameters.
ex:

const renderCar = (param1, param2) => {
//do something
}
renderCar ();

How do I acces it from an html file??
Please does anyone know?

?

Maybe Iā€™m missing something? But import/include the file and then call the function?

1 Like

create HTML element <div id='katorymnd'></div> in you html file body
Then update you js file renderCar(); to $('#katorymnd').text(renderCar()); now reload your page

The value of renderCar(); will display on your Html page at <div id='katorymnd'></div>

Remember to add a jquery library <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> in the head tag of your html page.

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service