Click here to Skip to main content
15,877,967 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
I have an InfoWindow with the following as its content:
<input type="button" id="go">

In my index.js, I have:
$("#go").click(function() { ... });
$("#go").on("click", function() { ... });
(neither works)

but the function is never called. Do I have to put this JS inside a tag within the content of the InfoWindow, or should it work like this?

<b>What I have tried:</b>

Updated 28-Nov-17 2:20am
ZurdoDev 27-Nov-17 15:54pm    
I do not know what an InfoWindow is but you can start by debugging this by checking what is $("#go").length when the .click function is wired up.
[no name] 28-Nov-17 6:46am    
The function does not work so I cannot do that.
ZurdoDev 28-Nov-17 7:29am    
Does the code in index.js ever run? If so, debug it and see what $("go").length is. If not, then you have your answer.
[no name] 28-Nov-17 7:30am    
I put the js code inside the infowindow and it worked
ZurdoDev 28-Nov-17 7:41am    
Glad to see you got it resolved.

1 solution

Solved by relocating JS, must have been out of scope
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900