The issue is that you have a quote inside a quote... Try:
<button onClick="Puck.write('NRF.setAdvertising([beacon.get("goo.gl/test123")]);\n');">Advertise</button>
Basically it's the web browser itself thinks the string onClick="... has ended when it sees the second quote.
onClick="...
There are other ways of doing it that are nicer, for instance you could use a third type of quotes! The templated String ones:
<button onClick="Puck.write('NRF.setAdvertising([beacon.get(`goo.gl/test123`)]);\n');">Advertise</button> </body>
Or you could add a function inside a <script> tag and call that, because inside that function you won't have the quoting issues.
<script>
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
The issue is that you have a quote inside a quote... Try:
Basically it's the web browser itself thinks the string
onClick="...
has ended when it sees the second quote.There are other ways of doing it that are nicer, for instance you could use a third type of quotes! The templated String ones:
Or you could add a function inside a
<script>
tag and call that, because inside that function you won't have the quoting issues.