#Passing multiple variables to local script

3 messages · Page 1 of 1 (latest)

junior ibex
#

I am trying to pass multiple variables to my local script. Currently, I am doing this one by one. Is there a better way?

<body data-png192src={`${png192Src}`}
      data-png512src={`${png512Src}`}
      data-url={`${Url}`}
>

...

<script>
let png192Src = document.querySelector('body')?.dataset.png192src;
let png512Src = document.querySelector('body')?.dataset.png512src;
let url = document.querySelector('body')?.dataset.url;
</script>
formal graniteBOT
#
Quiet in here?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.

viscid lava