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

how to create html element using javascript?

Examples :

 var Examples = '<ul class="rooms">';
 var  Examples += '<li class="full">';

then

statusHTML1 += '</li>';
statusHTML1 += '</ul>';

I don't understand this code above. Can you explain me please?

fixed code formatting

Hi Rostyk,

I wasn't sure if these were 2 separate examples here since you have 2 variables. Did I get the formatting right? You'll probably need to provide more context on this one like Jacob mentions.

3 Answers

what parts do you not understand, and what parts do you understand?

I just know that we can create ul/li this was (var sfe = sry for Eng). It's all.

 var Examples = '<ul class="rooms">'; << we created ul element right?

then

 we created var Examples += '<li class="full"> << i don't understand this section. 
Can you write full form of this code(  var Examples += '<li class="full">'; ) please? (sfe)

Okay?

Yep,good

You're not creating any elements in these examples. They're only strings containing html.

The code appears to be trying to build up an unordered list and then presumably it would get appended to the dom later.