'Google CSE search box does not appear after adding java script somewhere else on the page

I added google cse on my page. I used the easy way, so just pasted :

<script async src="https://cse.google.com/cse.js?cx=123456789"></script><div class="gcse-search"></div>

It worked perfectly. Until I added some other JavaScript at the end of the page. The page runs the script perfectly fine and the page contents, but the google search box disappears. When I comment out my added JavaScript the google search box appears again.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source