1👍
You’re very close, all you need to do is add an event.preventDefault()
to prevent the page from actually submitting the form. All you really want to do is call the display()
function.
Fiddle here: https://jsfiddle.net/kd4Lnwtj/5/
- [Chartjs]-Customize different tooltips of bar chart
- [Chartjs]-Django ValueError The view todo_lists.views.visualisation didn't return an HttpResponse object. It returned None instead
0👍
From https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
The default type
attribute for any <button>
within a <form>
is “submit”.
Try adding type="button"
to the display button. That should stop it from submitting and just let your JavaScript run.
Something like:
<button type="button" onclick="display(a,b,c,d)">display</button>
Source:stackexchange.com