Questions tagged [textnode]

textNodes in DOM, HTML, XML are nodes which contain only text, rather than the other node types of element, comment, and processing instruction.

textNodes in DOM, HTML, XML are nodes which contain only text, rather than the other node types of element, comment, and .

191 questions
1
vote
2 answers

JavaScript find all text nodes and return in a string

I need to define a function named getText() that finds all Text nodes at or beneath a specified node, and then extracts and concatenates the textual content of the nodes and returns it as a single JavaScript string. In getText() it will be an alert…
Pierce McGeough
  • 3,016
  • 8
  • 43
  • 65
1
vote
4 answers

Get number from element and wrap with span

I was hoping to indent a number, but the with html generated from my cms I can't seem to hook into the number and apply a style.
01. Header Lorem ipsum dolor sit amet, consectetur adipisicing elit, anim odio hic autem…
uriah
  • 2,485
  • 5
  • 28
  • 40
1
vote
2 answers

javascript strip text nodes from a NodeLists

I've found myself in a situation where I'm given an NodeList that I'm trying to drop into a jQuery object to manipulate. The problem is that array also includes text nodes, comment nodes, etc, and seems to confuse jQuery when you just say…
nicholas
  • 14,184
  • 22
  • 82
  • 138
1
vote
2 answers

get SINGLE text node from DOM object

Need to get all direct nodes from DOM element and don't actually know, how it many and what kind they are. .contents()? Ok, let's see.. $('
').html('

p

').contents() -> [

​p​

​] Ok. $('
').html('textNode').contents() ->…
extempl
  • 2,987
  • 1
  • 26
  • 38
0
votes
2 answers

How to get textnode by attribute. ActionScript 3.0

I have this XML language/ru.xml language/uk.xml language/en.xml How I can get a text node that corresponds to an attribute? That is, if the attribute lang = "ru", then I…
john
  • 49
  • 1
  • 3
0
votes
1 answer

removing the > from a list by identifying the proper textnode with javascript/jquery

I asked a somewhat similar question this afternoon and then realized as great as the answer is my question was not correct... given the following:

Martin Brody
  • 233
  • 1
  • 6
  • 12
0
votes
1 answer

IE7 creates empty text notes between floated elements

I'm working on a pagination sort of thing, which is simply just a bunch of floated anchor-tags inside a div. Now, in IE7, it inserts empty text nodes here and there, seemingly at random, which breaks the layout. Result: Example of how it looks on…
Nix
  • 5,746
  • 4
  • 30
  • 51
0
votes
1 answer

How to create a node and pass it to a function?

I have the following:

Here is some text blah meme hello world.

What I want to do is set the cursor after the span. I can use the following but this doesn't let me tell the…
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
0
votes
1 answer

TEXT_NODE in IE < 9 jQuery problems

I have this simple function to find "unwrapped" text and wrap it into a div. It is working fine apart from IE < 9. What can I change here to make it working please. $('#categories_list') .contents() .filter(function() { return…
Dom
  • 3,126
  • 14
  • 46
  • 68
0
votes
2 answers

"nodeValue" property of text node is blank - how do I test for it then?

So let's say I have a very basic page with a body, a single div, and a paragraph element inside with some text.

some text

Depending on the browser, the body / div elements will have text nodes (nodeType…
dkugappi
  • 2,664
  • 5
  • 21
  • 22
0
votes
3 answers

Extract text from Text Node using XPath

I am new to XPath and trying to capture the values "Time: " and "13:45" from the following HTML snippet. Any help or suggestion will be really useful. Thank you!

Time:

Anaras
  • 1
  • 2
0
votes
1 answer

GraphQL Query error with Contentful and Netlify

I'm not an expert coder but have this error in my Netlify Account where I am trying to update code and such and keep getting this error on my builds. The error is : GraphQLError: Field "jsonLdAnswer2" of type "contentfulTechnologyJsonLdAnswer2 …
ironcove
  • 21
  • 2
0
votes
0 answers

DOM Operation Unsuccessful - Show HTML in Element

Working code here is mixed with non-working code. The code works up until the line where it commands the innerText to be of x.innerHTML.substring(3,-3) This is the function I am calling on a click EventListener for "click". It does go to the…
Anthony Pulse
  • 71
  • 1
  • 7
0
votes
1 answer

Adding TextNode to HTML element with appendChild()

I am trying to create a simple "Shopping List" whereby the user types in the name of the items and then click the "add to List" button to add the items to the list, which it will appear in an ordered list manner. I create an li element for every…
zach
  • 37
  • 6
0
votes
1 answer

Convert [Object text] to plain text in JavaScript

i have following code: const x = document.createTextNode('Helloooo') document.body.insertAdjacentText('beforebegin', x) and after execution i see something like [object Text]. My question is how do I see the clear text, thus "Helloooo"? According…
Mr. RJ
  • 224
  • 5
  • 14