About 716,000 results
Open links in new tab
  1. Difference between textContent vs innerText - Stack Overflow

    Sep 7, 2018 · @ShimonS innerText is much more performance-heavy is true, but is to be taken relatively: if innerText is 100x slower than textContent on avg, and textContent takes 1/1000 of …

  2. How do I change the text of an element using JavaScript?

    Aug 31, 2009 · However, as others note, if you are not the source for any part of the text string, using innerHTML can subject you to content injection attacks like XSS if you're not careful to …

  3. javascript - How to get element by innerText - Stack Overflow

    Sep 28, 2010 · function findByTextContent(needle, haystack, precise) { // needle: String, the string to be found within the elements.

  4. Adding text to an existing text element in JavaScript via DOM

    Jan 20, 2017 · I am trying to figure how to add text to a p tag or h1 tag that already has a text node. For example: var t = document.getElementById("p").textContent; var y = …

  5. How to change the Content of a <textarea> with JavaScript

    Dec 4, 2020 · innerText removes all of the node's children and replaces them with a single text node with the given string value. In this particular case an empty string is a perfect answer to …

  6. How do I load the contents of a text file into a javascript variable ...

    That's like saying Q: "how do you take money out of a bank" A: "Go into the bank and write a check for cash". You: "That's all fine except if I want to take money from someone else's …

  7. Why write <script type="text/javascript"> when the mime type is …

    Sep 29, 2015 · Explains the purpose of writing <script type="text/javascript"> when the MIME type is set by the server.

  8. javascript - Get Text Element - Stack Overflow

    If you want to get only the text that is directly in the element use nodeValue or text Content: like this: text. var a = document.getElementById("id").childNodes[0].nodeValue; var b = …

  9. Getting the value of text from a text object in JavaScript

    Oct 29, 2009 · Learn how to retrieve text values from a text object in JavaScript with this guide.

  10. Extract the text out of HTML string using JavaScript

    Mar 6, 2015 · I am trying to get the inner text of HTML string, using a JS function(the string is passed as an argument). Here is the code: function extractContent(value) { var content_holder …

Refresh