I am attempting to create a select option that will display a different chart when changed. However, I am encountering two main issues:
1. The chart is not displaying properly within the div width. 2. How can I hide other charts when one is displayed?
HTML
<div style="width:80%;">
<select class="selectchart" id="selectsolicitacoes"><option>By month</option><option value="#hg3">By week</option><option value="#hg2">By day</option></select><br>
<div id="hg2" style="min-width: 310px; height: 400px; margin: 0 auto; display: none;"> </div>
<div id="hg3" style="min-width: 310px; height: 400px; margin: 0 auto; display: none;"> </div>
Javascript
$(document).ready(function(){
$('#selectsolicitacoes').change(function(){
var element = $(this).val();
$(element).show();
});
});