Using Navbar Dropdown Button Checkbox in Mapbox?

We are searching data for your request:
Upon completion, a link will appear to access the found materials.
I am creating a map application in theBootstrap
framework. I have a drop-down with 3 buttons to toggle layers on and off. I am using aglyphicon
as the checkbox with text to the side. If you click the checkbox, the layer switches as expected. However, if you click on the text it changes the checkbox, but does not control the layer toggle. I have tried wrapping the label with aspan
but this did not work.
Any suggestions?
HTML:
BASEMAP
JavaScript:
$("#mapLabel").click(function(event) { console.log("Click"); layerClicked = window[event.target.value]; if (map.hasLayer(layerClicked)) { map.removeLayer(layerClicked); } else{ map.addLayer(layerClicked); } ; });
Try this jquery method: http://api.jquery.com/find/
$(".your-span-class").find("#mapLabel").click(function(event) {…
I think the issue is your either selecting a parent element or a child element, which will be easier debugging in a web browser inspector. I don't believe Bootstrap is your issue.
On a separate/quasi-related note, I've found that the Semantic-UI Framework documentation a bit more helpful than Bootstraps with implementing such functionality. And, it works with jQuery. I really don't use Bootstrap anymore, and would recommend Semantic-UI as an alternative to anyone.
exactly on target :)
Agreed, the remarkable thought
Don't be cheated on this account.
full of FOOFOL !!!
wonderfully, very valuable answer