mercredi 19 avril 2017

Styling a checkbox with its text

I would like to style a checkbox () along with the text contained within the opening and closing tags

Here is where I am created my checkboxes

  html += "<p class='oneLine'><input type='checkbox' class='section' checked=true id='" + key + "'>" + key.replace(/_/g," ") + "</input></p>";

And here is where I am styling them

    $(document.getElementById(elem.getAttribute('name')).parentElement).addClass('bg' + topic);

So this works - but only because I've put a <p></p> around my <input></input>. Without the <p> tag and .parentElement, it only styles the checkbox.

Is there a (better) way to style the along with the text included before directly?




Aucun commentaire:

Enregistrer un commentaire