The normal view on this is that spiders do not run scripts on your site.
This, in my opinion, is the best approach, since although some of the Googles robots will execute JS, it will not always do all this or the way you expect
To see your page exactly, as it will be seen that the Google bot site has set up a webmaster and user account, select "fetch as bot".
But remember, although Google is the largest, it is not the only search engine, so I always recommend not having any content that you want to run through JS.
source share