dimanche 5 novembre 2017

Javascript: Checkboxes on Forms and output

I run a large Discord server and I'm making a channel for people to post template information about their online groups. To make complying with the template either, I've created a single html page which takes the information that goes in the template and regurgitates it into a box on the bottom of the page with some nice bolding and italics where needed all ready for copy/paste.

Unfortunately I don't know Javascript so I'm just trying to piece things together and learning as I go. (I'm learning other languages but not this one in school.)

For some reason me trying to format code on here isn't working so I can't paste what I have so I'll just try and explain it.

I'm using oninput="groupNameFunction()" and I'm having the javascript grab the user entered data as they type it via grabbing the ID of the input field then regurgitating it out in the innerHTML of another element. And it works great.

But checkboxes (and probably radio buttons) don't work with oninput (for pretty obvious reasons) but I've been able to get onblur to work to some extent.

The problem is that I'm a beginning coder and I don't quite know or understand how I'll take all the results from all the checkboxes and regurgitate them out into a nice list when there's many IDs and many choices and it doesn't seem sensible to try and write all choices from a single thing into their own function, or how I'll handle the same thing with radio buttons.

I can't find any examples in stuff like W3 tutorials of this being done, it's probably that I just don't know the language to google it correctly.

Could someone point me in the right direction on how to make this work? Thanks.




Aucun commentaire:

Enregistrer un commentaire