Skip to content Skip to sidebar Skip to footer

Javascript - Unable To Display Ul, Instead Get [object Htmlulistelement]

I asked a question a day ago about getting the length of an array that was nested inside an array that was inside an object. Now that I am able to get the correct information to co

Solution 1:

I would recommend using either all dom node creation (like the first part of your code) or all string concatenation (like the second part).

A quick (and VERY DIRTY, imo) workaround, would be:

...<ul>'+entryDescriptions.innerHTML+'</ul>...

Solution 2:

You're concatenating (adding) a string with a DOM Object.

var entryHTML =
        '<divclass="entry">' +
        '<divclass="row">' +
        '<divclass="col-md-9">' + entryTitle + entryOrganization + '</div>' +
        '<divclass="col-md-3">' + entryYears + '</div>' +
        '</div>' +
        '<divclass="row"><ul>' + entryDescriptions + '</ul><hr /></div>' + //<--HERE
        '</div>' +
        '<br />';

You can either pull the text out of the object using Javascript, or update the page with entryHTML, then use Javascript to append the object entryDescriptions

Post a Comment for "Javascript - Unable To Display Ul, Instead Get [object Htmlulistelement]"