javascript - Bootstrap list-items activating on embedded span -


sorry title, found no better way describe it.

i have list-group , want buttons show specific color when active. somehow, embedded spans capture click , seem not count part of a.

how can fix this? want button change color, no matter click (on span or anywhere else)

the code here: https://jsfiddle.net/zj6uwmvu/

thanks

here revised code click handler. if event target not link, means child badge clicked. if case, find closest link (the parent) , assign target.

$('.location').find('.location-picker-list .list-group-item').on('click', function(e) {     var target = $(event.target);     if (!target.is('a')) {       target = target.parent('a')     }     e.preventdefault()   target.closest('.list-group').children(".active").removeclass('active')   target.addclass('active') }) 

enter image description here

https://jsfiddle.net/zj6uwmvu/11/


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -