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
2
votes
1 answer

Add css style into textnode dynamically

I'm having a problem of adding a css style into the auto generated textnode. I know that the textnode does not has any parent node. So I cannot just append the css style in it. Basically, what I need to do is when user clicks on the "+" button…
R.Spark
  • 955
  • 2
  • 16
  • 22
2
votes
1 answer

why can't I insert text object into an element's innerHTML

we can assign the input value to a variable and then we're assingning that variable to an element's innerHTML, likewise why can't I insert text object into an element's innerHTML?? eg code: x = document.getElementById("my_input"). value; y =…
Indu
  • 37
  • 8
2
votes
2 answers

How to access text in a website using Java Selenium

How to access text in a website using Java Selenium? HTML snapshot: Can someone explain to me how to access the demouser and email id using java selenium in the above picture https://phptravels.com/demo this is the website im working on
2
votes
1 answer

How can set value of type Text node for Attribute of html elements

according to Text element document in MDN Value of Attr Node Can be of type Text element. The Text interface represents the textual content of Element or Attr. But how can i set value of a DOM element attribute to Text object. Some things like…
Ali Qamsari
  • 93
  • 1
  • 10
2
votes
1 answer

jQuery custom selector for text nodes

I would like to extract text from a DOM element using a jQuery custom selector. It should only select the text node without it's tagged siblings (much like /text() in XPath). Background: I am working on a Firefox extension, that extracts some…
modoq
  • 65
  • 6
2
votes
4 answers

How can i style textnodes that are direct children of a body-element?

I have a body elemnt containing textnodes as a direct children, but patragraphs too. Now, i would like to create my css so that this textnodes get specific css settings. On the other hand i do not want to style textnodes that are deeper down the…
Thariama
  • 50,002
  • 13
  • 138
  • 166
2
votes
1 answer

Filter by class names for changing text, using Javascript TreeWalker

Following that discussion, I'd like to understand how to use TreeWalker to change text on textNodes filtered by class names. I'd like to replace all numbers with "x" on

only. There's a piece of solution here, but the final jQuery…

DimNC
  • 130
  • 10
2
votes
0 answers

Truncate HTML text until the text does not overflow the container

I am trying to build a function that reduces an HTML text until it does not overflow its container (I don't want the last line broken for the middle). I've taken a look at this question, but the solution is just to manage special characters as <>&.…
ElChiniNet
  • 2,778
  • 2
  • 19
  • 27
2
votes
3 answers

Selecting a specific text node with phpQuery

OK, this is driving me nuts. I'm trying to screen-scrape the following bit of seemingly trivial HTML with phpQuery: 10-05-2009
06:10
17:35 -1 The date is easy since it's wrapped in the nobr tag, so eg.…
lambshaanxy
  • 22,552
  • 10
  • 68
  • 92
2
votes
2 answers

Using a TreeWalker to retrieve non-Javascript text nodes

This question teaches how to get all TextNodes inside the document, and this is getting me the Javascript texts as well. What is the best way to filter out all the Nodes that are Javascript code?
lvella
  • 12,754
  • 11
  • 54
  • 106
2
votes
3 answers

javascript innerHTML without childNodes?

im having a firefox issue where i dont see the wood for the trees using ajax i get html source from a php script this html code contains a tag and within the tbody some more tr/td's now i want to append this tbody plaincode to an existing table.…
John Doe
  • 2,746
  • 2
  • 35
  • 50
2
votes
1 answer

Phone number transformation. Separate prefix in brackets

There is an element: (987) 123-45-67. It is necessary to transform it in: (987) 123-45-67. How it can be made?
Kalinin
  • 2,489
  • 8
  • 37
  • 49
2
votes
3 answers

How to determine if there exists text at the beginning or end of a parent element? HTML DOM & JavaScript

Let's say we have a nested span: And we want to know whether or not text exists here or here Let's say we have reference to the parent element node. Please note…
CaffeinateOften
  • 571
  • 1
  • 6
  • 19
2
votes
1 answer

How is this an "Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist. " error?

TLDR: see: http://codepen.io/andrew-luhring/pen/Dkned for full example. I have no idea why uncommenting the lines commented out below will produce the error: "Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does…
Andrew Luhring
  • 1,762
  • 1
  • 16
  • 37
2
votes
1 answer

\n is not working with text node in javascript

In this code in TextNode i tried to put strings in different line by using \n in the following code: var CC = function(valu, name, age){ var parent = document.createElement("div"); parent.id = valu; …
user3138833