I get strange behavior in Firefox when I put checkboxes inside a list (ol, ul, dl) and then dynamically insert buttons above the list. If I start with something simple list, for example:
<dl class="c"> <dt><label for="a1"><input type="checkbox" id="a1" />one</label></dt> <dt><label for="a2"><input type="checkbox" id="a2" />two</label></dt> <dt><label for="a3"><input type="checkbox" id="a3" />three</label></dt> </dl>
and add some jQuery as follows:
$(document).ready(function(){ var a = $('<button type="button">a</button>'); var b = $('<button type="button">b</button>'); $('<div/>').append(a).append(b).insertBefore($('.c')); });
... then open it in Firefox, at first it looks fine. But check the first box, reload the page, and the box will move to the second block . Reboot again and it will jump to third. Reboot again and the checkboxes are not checked.
If I do not leave one of the buttons, discarding one of the append calls, this is normal. If I changed the buttons to divs or something like that, that's fine. If I replace the dl tag with a div (and get rid of the dt tags), that will be fine. But I need both buttons, and the checkboxes should be on the list for what I'm trying to create.
Does anyone know what causes this?
Daves source share