(instead of ‘<br>’ tried ‘\r’ but also doesn’t do line-breaks… oh brother…
;-o
thanks again for all your help, Paul… (still haven’t read your long post (#15) regarding obj’s… want to solve all these issues first, then get to that… man, this thread is getting so long…
I appreciate your help so much… thanks to your help and the help of others here @ Sitepoint I’ve learned so much about all this stuff in the past week…
doing lists (or tables) must be a lot of fun with this approach…
(I actually have done this stuff with plain JavaScript, but not in a long time… need to brush up on old DOM techniques…
PS (edit): so how does jQuery parse “<br>” that it prints it like an HTML tag (it converts it to an HTML tag…) and plain JS can’t?
(because in plain JS this also doesn’t work… content = prop + ': ’ + userObj[prop] + ‘<br>’; )
I know… I just wanted the challenge of doing everything with plain JS… but this code is great as there are things here about the use of innerHTML I didn’t k now…
such as:
they only work in this example if you do document.querySelector(‘Content’).innerHTML += ', '; and not if you do
Well you don’t have to, but what with all of those plusses and equal signs in the code, it helps to make it easier to understand what is going on, doesn’t it?
All three do exactly the same job - what’s important with them is how clearly they communicate with you, the person dealing with the code, about their intent.
[quote]had no idea you have to enclose value in ‘()’
Well you don’t have to, but what with all of those plusses and equal signs in the code, it helps to make it easier to understand what is going on, doesn’t it? [/quote]
yes, it is easier, of course, to enclose those composed strings in parens…
(I didn’t realize it was optional…)
When you use jQuery to get elements from the DOM, it returns them wrapped in an object which provides all the jQuery methods you’re used to. It doesn’t give you direct access to properties like innerHTML, as it expects you to set that through its .html() method.
You could access the underlying node though, and set the innerHTML property, like this:
There’s a video explaining, in some detail, how objects, prototypes and inheritance work in JS. There’s also a section at the bottom of the page where you can enter your own code and it will visualize the prototype chain for you.