Grow your CSS skills. Land your dream job.

To-do-list Site issues

  • # January 8, 2013 at 7:11 pm

    I think I’ve figured it out!

    The reason the checkboxes are being reset is the way the innerHTML() is adding content. Instead of just appending the new content, you’re grabbing the existing content, then overwriting it with a copy, plus the new content. Basically.

    This means the HTMl is preserved perfectly, but NOT the state of the elements, for instanced, the checked property.

    Instead, you should be using .insertAdjacentHTML(). Like this: [CodePen Example, oh yeah!](http://codepen.io/JoshBlackwood/pen/oglzC)

    I had the sudden realization of what was going on whilst on the ride home from work, and tested it as soon as I could get to a computer, using jQuery. When I was proven correct (I used jQuery to set the checked attribute as a quick test), I looked it up on StackOverflow since I didn’t know the proper way to do it using vanilla JavaScript.

    With this, you should be golden. Let me know how it goes!

    # January 8, 2013 at 7:43 pm

    NICE! Works perfectly! You f*cking genius!

    # January 8, 2013 at 7:48 pm

    Awesome!

    I’m glad I could help! *tips hat*

Viewing 3 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".