Probably a very easy question for anyone comfortable with Javascript to answer. Basically I have a tool bar with buttons in an HTML/Javascript/PHP web app I'm working on:
<div class="segmented-control">
<a class="control-item" onClick='showMapMarkers()'>
<img src="customIcons/Map.png" width="15" height="20" >
</a>
</div>
... and you'll see the onClick event calls the function showMapMarkers() which right now is not implemented and I'm only using this:
function showMapMarkers(){
alert("show map markers");
}
However I get this error:
ReferenceError: Can't find variable: showMapMarkers
If I write the same alert statement directly into the bar button item then the alert works fine so I guess it's a problem of on-click scope not reaching the showMapMarkers()
function but I can't understand why.
Any ideas?