electerious / basicLightbox

The lightest lightbox ever made.

Home Page:https://basiclightbox.electerious.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Radio buttons labels not working inside basiclightbox.

kalmerrautam opened this issue · comments

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/

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).