Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8537227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:51:02+00:00 2026-06-11T10:51:02+00:00

How come when I do a console.log on elements that I append to a

  • 0

How come when I do a console.log on elements that I append to a parent div come out with a bunch of carriage return nodes. Is there a way to remove this because when I try to add some css to these they break the application.

Here is my setup. I’m using underscore template to create my html. The tmpl is all working fine.

    var tmpl = $( template({items : list}) );

    var items = $(_.filter(tmpl, function(item){ 
        return ! $item.hasClass('pin'); 
    }));

    var domItems = items.appendTo($('.container'));

Here is the log

domItems = 

[<TextNode textContent="\n          \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, <TextNode textContent="\n           \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item, <TextNode textContent="\n         \n              ">, div.item]

I just want it to be returning the div.item element

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:51:04+00:00Added an answer on June 11, 2026 at 10:51 am

    Some browsers consider empty spaces as a text node. To filter them, just exclude all nodeTypes which are equal to 3 (Node.TEXT_NODE == 3):

    var items = $(_.filter(tmpl, function(item){ 
        return ! $item.hasClass('pin') && this.nodeType !== 3;
    }));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to nodejs, the only way that I can come up with is
Hope there is some out there that can help!, While debugging a WCF service
Basically I want 200 characters maximum to come up in Console.ReadLine() for user input
I'm using the: console.log() method to log messages to firefox (3.6.6)/firebug while working on
I have come across a website that appears to use Ajax but does not
I store a jquery object (a collection of html elements) but when I come
How come I get this message from Firefox Web Console The Web Console logging
I currently have this JS statement everywhere in my code: window.console && console.log(Foo); I
This is a question that has come up a few times on here in
i've been experimenting with javascript's prototypal inheritance and have come across something that perhaps

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.