score:1
It only persists for a short time because you have placed your button
within a form
here:
<form name="contact" action="" method="post">
<button id="control" onclick="js_fun()">Click me</button>
</form>
When clicking the button the form is submitted. Since action=""
it submits the form to the same page, and you once again have to call js_fun()
to render the graph. The graph is only shown the short time between clicking the button and the new page being loaded.
You could make your button code like this:
<button id="control" onclick="js_fun(); return false">Click me</button>
Or just remove the form
tag if you're not actually planing on submitting a form at any time.
score:1
If you does not give any type for the button tag element, it will point as submit. when you click the button, the form is submitted first after that only JavaScript calls.You did not mention any action for the form tag, so form is submitted to the same page.So button JavaScript click event does not call because the page is refreshed each button click.
You have 3 ways to resolved this type issues
1.If you does not post any form values then remove the form tag, just put only the button tag.
2.include the return false in the button on-click event.
<button id="control" onclick="js_fun(); return false">Click me</button>
3.Include button type="button" in the button tag element.
<button id="control" type="button" onclick="js_fun();">Click me</button>
Source: stackoverflow.com
Related Query
- Not able to render/retain graph on button click HighChart
- html button not firing event to the required graph container firing to different graph in Highchart JS
- Not able to render windbarb Highchart in angular
- Highchart json from mysql data not able to show up in line graph
- HighChart Graph aligned wrong on Xaxis .. not able to reproduce on JSFiddle
- Download Highchart Graph on different button click
- how to reset Highchart chart width in percentage on Button click
- highchart export button not show
- Highchart heatmap: select all cells on click of button or checkbox
- highchart not shown data graph
- Why does this highchart plot not render in IE or chrome?
- Shiny: Increase highchart size on button click
- Not able to render the charts in pdf using Wickedpdf and Highcharts in rails 2.3 app
- Highchart + Plotly dash Graph displaying before pressing the button
- Line chart legend color not getting update on button click (highcharts-angular)
- Highchart data each row on gridview to display different data on button click open modal
- displaying highchart in button click
- highcharts - Not able to switch between bar to column or vice versa graph type in drilldown
- Highchart graph customization not performing well
- HighChart Line Graph not Showing
- Highchart not able to use javascript variables(arrays) in series data
- HighChart Graph not displaying in Mail
- Highchart pie graph not displaying in r
- Minimum tick interval (monthly) not working for datetime Highchart graph
- x-axis, y-axis lines does not appear, when I include 3D chart library of HighChart in my code
- Adding a Button to toggle between graph and table using Highchart
- Highchart does not render on webpage, Javascript
- How to modify the code so that Highcharts graph does not cover fixed navigation bar at the top of the page?
- Highchart showing up empty until button click
- Not able to align highchart made using angular js
More Query from same tag
- Highcharts adding labels/columns with no data
- Disable line from tooltip to point location on the chart
- Highcharts points and lines are missing
- Static Y Axis in Highcharts?
- Highcharts gauge do not display
- Optimal way to display data with uneven time interval Highcharts
- How to create column-range chart from data of a HTML table?
- Highcharts Treemap Data Labels issue in IE & Chrome
- Highcharts polar wind rose chart with segments in trapezoid form
- Highcharts yAxis text rotation issue in IE8
- Is it possible to use data grouping in Highcharts without Highstocks?
- Why is the Highcharts tick placement different in two similar charts?
- Highchart heatmap for days in a month from 8:00 to 17:00
- Highlight active data label in Pie Chart (High Chart)
- Highcharts using value not an array Ajax
- Time series horizontal bar chart for running queries visualization
- Highcharts/Highstock add shapes/flags to multiples panes not just the first pane
- Multi series export is misaligned in highcharts
- Highchart and HTMLCanvas
- How to disable label from Highchart
- How to add a separate marker(an arrow) under a line
- highcharter: capture currently selected min and max dates in stock plot
- How do i show Last seven days of a week from current date in area spline categories highcharts
- how do you create a link on highcharts to open up pop up window with another chart
- draw images on xaxis in GWT highcharts
- Bar-chart gradient background not showing - Highcharts
- why highchart boundbox doesn't indicate axis label overlap?
- Error #14 while trying to read CSV data
- how to remove space above semicircle angular gauge
- Highcharts xAxis values index