I have a simple html text input field within a panel on top of an OpenLayers Map. Everytime I click in the input field, the click event gets propageted to the map. I want the click event not to be propagated to the map when it is within the input field. How can I achieve this?


This is the expected behaviour and it's called Event Bubbling. I'd recommend you to check this Bubbling and capturing tutorial for a better understanding.

Anyway, sometimes it's useful to avoid it and you can achieve this by calling:


inside your event handler function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.