electerious / basicLightbox

The lightest lightbox ever made.
https://basiclightbox.electerious.com
MIT License
557 stars 55 forks source link

Radio buttons labels not working inside basiclightbox. #19

Closed kalmerrautam closed 6 years ago

kalmerrautam commented 6 years ago

When I place radio buttons with labels inside BasicLightbox, then activating radio buttons with label click won't work.

Same radios with labels work perfectly when BasicLightbox is removed.

See fiddle: https://jsfiddle.net/kalmerrautam/8kvw76er/2/

electerious commented 6 years ago

It's because you're creating a lightbox with .outerHTML. This grabs the HTML and places it into a lightbox. The original HTML however stays, meaning that you have the same input id twice. Clicking the label will toggle the HTML that is not visible.

I recommend to remove the original HTML before you show the lightbox: https://jsfiddle.net/x0cpe4y2/

I'm planning to update basicLightbox to make using existing elements easier. basicLightbox.from(elem) for example (related to #17).