# Acces js const from html file

**URL:** <https://www.phphelp.com/t/acces-js-const-from-html-file/34267>\
**Category:** Javascript & Ajax\
**Created:** [November 16, 2021, 10:07am UTC](https://www.phphelp.com/t/acces-js-const-from-html-file/34267 "2021-11-16T10:07:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anette](https://www.phphelp.com/letter_avatar_proxy/v4/letter/a/e9bcb4/32.png) [@Anette](https://www.phphelp.com/u/Anette)\
**Post date:** [November 16, 2021, 10:07am UTC](https://www.phphelp.com/t/acces-js-const-from-html-file/34267/1 "2021-11-16T10:07:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![whispers](https://www.phphelp.com/letter_avatar_proxy/v4/letter/w/858c86/32.png) [@whispers](https://www.phphelp.com/u/whispers)\
**Post date:** [November 16, 2021, 2:03pm UTC](https://www.phphelp.com/t/acces-js-const-from-html-file/34267/2 "2021-11-16T14:03:41Z")

</div>

?

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

---

<div class="post-metadata">

**Author:** ![katsry](https://www.phphelp.com/letter_avatar_proxy/v4/letter/k/2bfe46/32.png) [@katsry](https://www.phphelp.com/u/katsry)\
**Post date:** [November 20, 2021, 7:35am UTC](https://www.phphelp.com/t/acces-js-const-from-html-file/34267/3 "2021-11-20T07:35:22Z")

</div>

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.
