Pass parameter to javascript function in Go template

97
February 13, 2020, at 01:30 AM

I have the following in my Go's template.

<button type="submit" class="validate_button" onclick="validate({{.Person.ID}})">Validate</button>

This is not working and I am getting this Javascript error :

"Property assignment expected."

This works perfectly of course :

<button type="submit" class="validate_button" onclick="validate(1234)">Validate</button>

Whats the right syntax here?

Note :

I am using VS Code. The same is telling me there is an error but I can compile just fine. The thing is once I ran the app there is no "button" on the page. It simply disappears. It works correctly when I hardcode a value though.

READ ALSO
Load More data jumps up after loading data AngluarJS with fireFox

Load More data jumps up after loading data AngluarJS with fireFox

When I load dynamic data into my page using AngularJS, the page jumps to the top (The containing element) if I use EnablePromise functionThis happens with Firefox but not with Chrome

68
My Angular App works locally, but it gets an error on Heroku. Source Map URL: index.js.map

My Angular App works locally, but it gets an error on Heroku. Source Map URL: index.js.map

I can pull data from the JSON locally (when using ng serve) and modify the DOM with it, but not on Heroku

93
Can this script be used to create multiple SVG elements?

Can this script be used to create multiple SVG elements?

I have the following JavaScript that creates a graph using snap SVG

109
Prevent reloading a website after sweetalert

Prevent reloading a website after sweetalert

On a web page there is a table with a few rowsIn each line there is a button that triggers a Javascript function:

112