This question already has an answer here:
- Verify External Script Is Loaded 6 answers
Im using the following to show/hide <section> of my page, I use the following on cllick to load some charts when the "Charts" button is clicked:
$(document).ready(function(){
$("#graph_btn").on("click", function(){
$(".table").hide();
$(".charts").show();
$.getScript("/js/charts.js");
});
});
The problem is that if i click to show the results table, then i click to load the charts again, they are reloaded again and overlap each other, how can i wrap than getScriptin an If statement to check if the button has already been loaded? is this possible and if so can i include it in this .click function pr do I need to have a separate function? thanks
Aucun commentaire:
Enregistrer un commentaire