How do I load a driver before loading a js file?

0

I'm doing a small guided tutorial for a web page, I'm using a library called introjs , which helps a lot for that task.

But I have a small problem, the web page is created with MVC Razor, and the menu part is dynamic, and it is loaded from the controller, and when I assign the variables for the Intro library to work >, first the html is loaded, so the controller does not take the library when I execute it.

My question is, how do I load the invocation of IntroJS with the controller asynchronously?

    
asked by Juan Restrepo Riascos 17.07.2018 в 00:45
source

1 answer

0

I'm not sure how you have it ... (if you went up the code I could see it more clearly)

But, to have the execution of a JS Script after loading, first, at the end of the View

<script src="script/myscrip.js"></script>

Also, the main function must be inside a Document Ready (in the JS document, assuming you are using Jquery)

$(document).ready(function(){    
// todo tu código aquí

})

If you do not use JQuery, pure Javascript

document.addEventListener('DOMContentLoaded', function(){ 
    // your code goes here
}, false);
    
answered by 17.07.2018 в 06:52