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 trialMaria Cecilia Le Brech
3,611 PointsCan i use something else than "append" to show results in a js?
THIS IS THE JS //Back-End// var number = function(x) { for (var index = 1; index <= x; index += 1) { if (index % 5 === 0) { $(".pingpong").append("<li>" + "pong" + "</li>"); } else if (index % 3 === 0) { $(".pingpong").append("<li>" + "ping" + "</li>"); } else if (index % 15 === 0) { $(".pingpong").append("<li>" + "pingpong" + "</li>"); } else { $(".pingpong").append("<li>" + index + "</li>"); } } }; //Front-End// $(document).ready(function () { $("#blanks form").submit(function(event) { event.preventDefault(); var result = $("input#number").val(); number(result); $("#output").show(); }); });
1 Answer
Simon Coates
28,694 PointsThese are your jquery options for inserting inside a particular element: http://api.jquery.com/category/manipulation/dom-insertion-inside/