Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

data won't stay

i'm building a checkbox form, and when it's submitted the pops up on new page but it will not stay it pops in then disappear. How can i get it to stay?

function processOrder(){
                //var x = document.forms[0].length;
                //document.write(x)

                    var checkBoxes = document.getElementsByTagName('input');
                            //alert(checkBoxes.length);
                        var param = "<strong>Meal Plan:</strong>"+"<br>";
                        for (var counter=0; counter < checkBoxes.length; counter++) {
                            if (checkBoxes[counter].type.toUpperCase()=='CHECKBOX' && checkBoxes[counter].checked == true) {
                                param += checkBoxes[counter].value  + "<br>";
                            }
                        }
                            document.write(param);

                }

Sorry, but come you explain the problem and your goals with a little more detail and possibly post the html.

1 Answer

once checkboxes are checked and submit button is clicked show values of selected boxes. What is happening right now is the values appear and disappears, I need them the stay and now disappear.

So is this the goal of the work flow:

  1. User checks box.
  2. User clicks submit.
  3. Hidden value for box selected appears?( this is the part I don't understand).