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

I have a question about the quotes differences between in html and JavaScript.

I want to know 'question' , and 'parange'. why do we need to add quotes. I know you need to add quotes for string. So my question is does question in id= 'question' is still a string. If is string why does it have so much power, I mean it have more functions than any other string which will only to show in the pages. I want to know the differents between id= '' , and .innerHTML = '' . thank you.

2 Answers

I don't completely understand your question, but I will try to give you some information anyway. HTML and JavaScript are different. With that in mind, there is no comparison between quotation marks in HTML and in JavaScript. When you say id = "whatever", I can only assume that you're talking about the id tag on HTML elements. This tag actually has no power. It is only useful as a way to specifically target an HTML node. innerHTML on the other hand, is a property on html nodes. Basically, HTML is one huge string. When you select a specific HTML node in JavaScript, you can alter the HTML string between the selected tags by changing what's contained in the innerHTML property. Basically, you're just replacing one string with another when altering innerHTML.

Thank you for giving me so great information, you have got what I want to ask. I learn from what you told that html is actually a string. That have fix to me that the reason words between <p> ...</p> tabs don't add quotes. Thank you very much.