Questions tagged [dom-manipulation]

The process of changing the Document Object Model (DOM). It includes adding, removing or changing DOM elements.

825 questions
5
votes
1 answer

TypeError: Cannot set property 'textContent' of null

Currently having issues with this code for a while, and I keep getting errors no matter how much i check it out. The errors are all the same: TypeError: Cannot set property 'textContent' of null when i'm using querySelector or when i'm using…
Evie
  • 53
  • 1
  • 1
  • 3
5
votes
2 answers

What exactly updates when the DOM is manipulated

I am trying to understand exactly what is updated with the regular DOM after a DOM manipulation. Suppose we have the DOM below and I use javascript to delete the li with the class blue. Does this mean that the browser looks at the parent of class…
trebek1
  • 755
  • 1
  • 8
  • 28
5
votes
5 answers

Cannot read property of undefined of function inside loop

I have the "error: Cannot read property 'shorten' of undefined" error when running my test. I want my loop to run the shorten function to check if the string is longer then 20 characters, and if so limit it to that. function ListView(list) { …
pyan
  • 865
  • 2
  • 12
  • 23
5
votes
2 answers

Stripe card element is not visible on the form

I am new to angularjs and just trying to integrate stripe api of version 3 in my angular app. I tried to follow the steps given in the stripe site. Now the problem is that in stripe site whole code is based on plain js or jquery. I tried to put the…
morohiki
  • 51
  • 1
  • 1
  • 3
5
votes
1 answer

How to move an Image on click in React Native

I've recently been learning React Native but haven't really found a way to manipulate the DOM. I've been trying to make it so that if I click on the TouchableHighlight my Image moves down a couple of px, but I have not managed to get it to move yet…
jasper
  • 937
  • 1
  • 9
  • 22
5
votes
1 answer

target specific element with mutationObserver

i am using mutationObserver to detect changes using bellow code var target = document.querySelector('body'); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { console.log(mutation.type); }); …
Ashish Patel
  • 921
  • 1
  • 10
  • 26
5
votes
0 answers

CSS transition freezes on external DOM manipulation

I am struggling with a CSS transition that freezes before it is finished because a returning API call adds some elements to the DOM, and this seems to create a conflict. The case is that of a flyout menu that overlays part of the page, and this menu…
audunskj
  • 86
  • 4
5
votes
2 answers

How to get the current position of an element in angularjs

I want to change the user interface on scrolling the page, and for that i want to get the position of div element (top and bottom), how can i do this in angularjs ? In the following code how can i get the top_position? var…
PRASHANT KUMAR
  • 185
  • 2
  • 3
  • 11
5
votes
2 answers

When virtual-dom is faster than manual manipulation?

I'm investigating virtual-dom right now, and I'm wondering whether virtual-dom is really faster than manual manipulation with view. Now I understand that virtual-dom and diff algorithm can prevent unnecessary re-flows, for example when we want to…
Ross Khanas
  • 1,491
  • 2
  • 15
  • 23
5
votes
1 answer

jQuery empty() vs text('')

Is there any different between $(element).empty() and $(element).text(''); Which one is better?
Atif
  • 10,623
  • 20
  • 63
  • 96
5
votes
2 answers

AngularJS Informer service

I'm using Twitter Bootstrap for UI in my webapp. Particulary its Alert component. I want to write a simple angular service to wrap Bootstrap's Alert to have a possibility of informing users from any peace of angular code. Like…
madhead
  • 31,729
  • 16
  • 153
  • 201
5
votes
3 answers

Availability of MutationObservers in Internet Explorer

AFAIK mutation observers are not available yet in IE. Chrome, Safari, Firefox have their implementations and its working its way through the standardization process. I'm wondering if anyone (preferably MS employee) knows the story with IE, or might…
5
votes
6 answers

jQuery - cannot bind events to dynamic elements?

I've come to maintain a piece of javascript that downloads some JSON data from the server, builds a new table row (like $('
Jakub Lédl
  • 1,805
  • 3
  • 17
  • 26
5
votes
1 answer

Grouping SVG elements dynamically

I am trying to dynamically wrap certain svg elements like rect,text,etc into a single g using javascript (jQuery) This is how the svg looks initially
...
Jugal Thakkar
  • 13,432
  • 4
  • 61
  • 79