Re: _javascript_ Problems

Most events in HTML happen after a state change.  In your case, I think you just need to record the state change in the event handler and not do anything else with it.  If you really want to be able to stop the checkbox from changing I believe that can be done with some extra args to the addEventListener call--I forget what it's called but there's two stages in event processing and you're subscribing to the one that happens after changes, not before.  But frankly I don't work at this level of the stack, and you shouldn't either in the long run, so someone else will have to give you more details on that.  You will quickly find that raw JS is a headache because of weird differences between events, differences between browsers, the list goes on.

If you want something that's more declarative, where html always respects your state rather than changing out from under you before you get a chance to process things, you kind of want react.  I say kind of because the model is a bit leaky, but in React you just feed the checkbox in your render method.  Bit hard to explain, but you might read their tutorials at some point.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : pauliyobo via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dark Eagle via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Dragonlee via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : kaigoku via Audiogames-reflector

Reply via email to