Questions tagged [dom]

The Document Object Model(DOM) is a way to programmatically refer to the elements of a markup language like XML and HTML. Use with [javascript] or any other programming language that has a DOM parser

Filter by
Sorted by
Tagged with
0 votes
1 answer
11 views

D280 final, trying to subscribe to data from API (angular)

Project: Interactive world map Use SVG map file to get country name Use country name for an API call Use information from API to update a text box with information from the API. I am following a guide,...
Earth2Fire's user avatar
0 votes
0 answers
4 views

Need to capture a DOM variable in GTM but the ID is dynamic and changes based on user

Need to return phone number in a form field as a variable in GTM, but the id is dynamic and is not being pushed to the datalayer. Wanting to pull out required value below. tried to regex the id (not ...
Clueless's user avatar
0 votes
1 answer
38 views

Write XML to ZIP

I am trying to pack two XML files into a zip file: The XMLs are generated with org.w3c.dom.* and I am trying to directly transform them into a ZipOutputStream. Single file example: public InputStream ...
Thomas's user avatar
  • 6,535
0 votes
0 answers
19 views

How to load a DOM in PHP through Google Chrome

I'm trying to download a DOM after JavaScript executed. This is possible from the command line: on MaxOS: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --ignore-gpu-blocklist --...
patrick's user avatar
  • 11.6k
0 votes
0 answers
29 views

How to add more values than one Element in the same node createElemnt()

How to add several concatenated values when creating an xml element using DOM, below is an example with one client_country value $nodead->appendChild($this->doc->createElement('Address', $...
Sławomir Dworaczek's user avatar
-1 votes
1 answer
38 views

Why does `mouseup` preventDefault affect selected text differently?

Calling mouseupEvent.preventDefault() will not prevent creating a new selection in general, unless you try to create a selection within the current selection. Array.from(document.querySelectorAll('...
David Mulder's user avatar
  • 26.3k
0 votes
0 answers
19 views

cancel any event or listener for a DOM element but not including mine

I'm building a chrome extension which sets the style to "none" of any element the user clicks, it looks like this: function handleMouseOver(e) { // Change the background color when the mouse ...
Victor Yazigi's user avatar
-4 votes
1 answer
36 views

Cannot access styles via JavaScript after DOM Changes [closed]

I dynamically add movie images into my DOM instantly as my pages loads from a file with the data in it, however now when I try to access they styles or change it, I get back undefined. My container ...
TreyarchPi's user avatar
3 votes
2 answers
168 views
+500

Is there a way to reinitialize jQuery?

Question JQuery is initialized on import. If window and window.document exist (and module doesn't), JQuery saves the references and uses them thereafter. Is there a way I can "reinitialize" ...
Daniel Kaplan's user avatar
0 votes
1 answer
47 views

Use recursion to render a virtual tree

Given an object that resembles a virtual tree. You need to recursively go through all the branches of the object and render the elements according to its internal hierarchy. I've written a function, ...
DorfStil's user avatar
-1 votes
2 answers
54 views

Grand Total Calculation Issue in Dynamic HTML Table with Quantity Input

I am facing a problem with the Grand Total calculation in a dynamic HTML table where rows can be added, removed, and quantities can be adjusted. The issue arises when a new row is added or a row is ...
z_ahamed's user avatar
0 votes
0 answers
30 views

DOM objects does not work with className and checked included

Have found something strange with DOM and handling as an object. Tried having className and checked as part of the object. This has not worked, can't find a reason for it or an explanation. Does ...
Virus0056's user avatar
-2 votes
0 answers
31 views

Title: Issue with Dynamically Created Elements Overlapping in JavaScript/HTML/CSS

I'm currently working on a web application where I dynamically create and append elements using JavaScript. The elements are history items that include a clock icon, text, a photo, and an up arrow ...
Mamtaganesh Gupta's user avatar
0 votes
1 answer
46 views

JavaScript not creating header inside div

function search() { var searchbar = document.getElementById("searchbar"); if (searchbar.value != null) { var searchResult = document.createElement("h2"); searchResult.value = "Search ...
Bob Blake's user avatar
0 votes
1 answer
27 views

Uncaught TypeError: can't access property "innerHTML", container is null

I have the following HTML file named index.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" ...
Ethan's user avatar
  • 407
0 votes
1 answer
38 views

Javascript I cannot remove eventlistener

I have a shortened version of my code below. The thing is I cannot remove the event listener inside a function, which fires a simple alert. Any help? const resizers = document.querySelectorAll("....
user_unknown's user avatar
-1 votes
0 answers
29 views

Cannot read properties of null (DOM manipulation) [duplicate]

According to the error message there is an error in line 20 when trying to append the element but I don't see the reason for which I get this message when trying to run the function: "caught ...
Klynk917's user avatar
0 votes
0 answers
23 views

CData not rendered in browser

function feed_fetch(){ const div = document.getElementById('feed'); div.innerHTML = ""; const url = "https://some-rss-url"; fetch(url) .then(response => ...
Nathan H's user avatar
  • 48.2k
0 votes
0 answers
28 views

Document is not defined using BrowserRouter from React Router DOM

I'm facing a small problem that is causing a 500 error. It occurs when I attempt to embed either my Main or Login component (depending on the authentication state) with the BrowserRouter from React ...
Nacho Tamayo's user avatar
-2 votes
1 answer
34 views

Saving user's cookie preference in JavaScript [closed]

I have this simple cookies banner that loads google analytics scripts if the user clicks on accept button. Then it remembers the choice for a month and does not show up again. However if the user ...
Adam's user avatar
  • 45
0 votes
0 answers
18 views

I want to capture the position of dom update in react to scroll to the position where the dom is updated

I have a very long nested form and after every field there is an error icon which update if any error is occurred anywhere in the form , instead of drilling into the form nodes to find the position of ...
casual dev's user avatar
0 votes
0 answers
45 views

check if the event's target is withing the component without using stopPropagation() [closed]

I'm using a custom select, Instead of using stopPropagation, how can I check if the event's target is within the component? This way I can avoid stopping the propagation of the click event globally. I ...
Seif Eddine Slimene's user avatar
0 votes
0 answers
30 views

Mock media query change event

I am working on writing Jest unit tests in my Angular app. I have a theme service that handles checking and setting users default theme. In particular, there is a function that listens to changes to ...
Cody Pritchard's user avatar
0 votes
0 answers
7 views

angularjs element attaches to DOM only on first page entry, but not on page refresh/re-entry

In my cordova/ionic app, in one page view button opens a modal and an ng-repeat generates the DOM elements. After the ng-repeat attaches all the new DOM elements, then I am cloning a hidden DIV and ...
rolinger's user avatar
  • 2,892
0 votes
1 answer
22 views

DOMParser() removes spaces

Simple code: const parser = new DOMParser(); const foo = parser.parseFromString(<p> Foo</p>, 'text/html'); console.log(foo); gives me this Where have all the empty spaces in front ...
nerdess's user avatar
  • 10.2k
1 vote
0 answers
44 views

Component loads outdated element list

The goal is to check each tab-element for its size in a variable tabrow: Tabs are handled on window-resize, when a tab is added/opened, when a tab is closed, when the sequence of tabs changes through ...
Mesa's user avatar
  • 21
0 votes
0 answers
19 views

How to solve " Failed to read the 'rules' or 'cssRules' property from 'cssstylesheet' ", while trying to fetch the css in React?

I am trying to print a page. I am fetching the HTML and CSS for that same page using javascript. After we try to print the page, another tab opens up for the print and we can print from that page. The ...
Aditya Majhi's user avatar
0 votes
2 answers
46 views

How to add and remove background color of multiple boxes on click event

When I am clicking a box, background of page should change to the color of box (that is happening), but what I want is whichever box I clicked last , that box color should also change. I am also ...
Sunil's user avatar
  • 3
0 votes
0 answers
50 views

Discrepancy in Widths of a Range and a Paragraph Element in JavaScript

I’m working on a feature in a web application that mimics the text selection behavior in Microsoft Office Word. Specifically, when you select text across two paragraphs in Word, the area between the ...
8535241's user avatar
  • 103
0 votes
1 answer
41 views

Change HTML DOM while page loads

I want to edit some node's content in DOM on the page, but if i do it using window.onload it's done only after the full page loaded and it is visible that the content of node changes. So, is there a ...
complex's user avatar
  • 17
0 votes
1 answer
30 views

Getting data from an XML document using DOM in Java

I'm trying to parse an XML file using DOM, but at the end only the last entry is output several times (in a loop). Tell me, please, what is the problem? (I'm a beginner in Java) XML with approximately ...
Илья Величко's user avatar
0 votes
2 answers
32 views

How to use scrollIntoView from text node

I can't figure out how to get the element of a text node but I can get the parent element. I've written a javascript routine to make a selection using a range. So I have a start node and end node ...
Terry King's user avatar
2 votes
2 answers
67 views

What is the difference between Virtual DOM and ReactDOM?

I am going through lot of articles over the internet asking the difference between the two, but almost everyone of them explains the difference between Virual DOM and Real DOM. According to my current ...
stardep's user avatar
  • 146
0 votes
0 answers
31 views

Escaping Numeric IDs for QuerySelector - Unexpected Double Backslashes [duplicate]

I'm working with SVG elements in a TypeScript project and need to query foreignObject elements by their parent g element's IDs. Some of these IDs start with a digit, so I'm using a function to escape ...
laujonat's user avatar
  • 342
1 vote
2 answers
48 views

How to change the opacity or visibility of an element using Javascript

I have 3 svgs I use in my button element an unchecked svg, checked and loading. By default the unchecked is set to 1 while the rest are 0. I'd like to change the opacity of the unchecked to zero the ...
Abdulmujeeb Ahmad's user avatar
0 votes
2 answers
40 views

Can you update a Vue Pinia store WITHOUT rendering data changes? Or rather, just rendering one data change?

I am using Vue3 composition with script setup. I am using a pinia store. I have an SPA where the user gradually alters data, which is stored in a history array. It is possible to recreate all the ...
DodgerB's user avatar
  • 26
0 votes
0 answers
38 views

When the page refreshes, there are new workouts being created

I am working on a website that the user can log workouts in. It is a very simple website. The problem is that when the user enters a cycling or a running workout (those are the only kinds there are ...
deepblue's user avatar
0 votes
2 answers
46 views

How to unit test a XML document to string transformation method

public static String convertDocumentToString(Document xmlDocument) { TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer; try { ...
britney1994's user avatar
-1 votes
0 answers
40 views

The selected text is not updated in the parent div, but the array is filled with text, separated by comma

Clicking, selecting the option value paragraph in the child div I need do fill the parent element content with this selected data, separated by comma. The console shows that the array is updated every ...
Ron's user avatar
  • 1
2 votes
0 answers
21 views

Using Webpack for browser extension problems accessing DOM elements of HTML

I'm creating a browser extension for firefox and originally had an issue about using require() statements in JS. I fixed this issue using Webpack to bundle the code and give me access to those ...
Cheggsie's user avatar
0 votes
0 answers
9 views

Prevent XMLSerializer from escaping special chars in script tags

I am trying to make a script that will generate an html page embedding scripts. I build the document in memory then serialize it with XMLSerializer.serializeToString. Problem: script tags don't ...
David Keller's user avatar
-1 votes
0 answers
20 views

Change the interpretation of a URL scheme

I want to be able to set an image src like this: <img src="ipfs://bafkreifvallbyfxnedeseuvkkswt5u3hbdb2fexcygbyjqy5a5rzmhrzei"></img> and have it be interpreted like this <...
ViteOrer's user avatar
1 vote
2 answers
33 views

how to use {{ form.as_p }} in javascript

I've a question, I am a Django developer, in my program I want to write a JavaScript file that when we click a button, the script file create a new form. The javaScript file: function noid(){ ...
MohammadAminGHS's user avatar
0 votes
1 answer
86 views

Changes to HTML not happening

I am expecting to hide the child ".summary-thumbnail-event-date" element in a specific parent "#block-yui_3_17_2_1_1697649009477_55853" element. This code works. function ...
DJ Full_Price's user avatar
0 votes
1 answer
56 views

Problem with buttons addeventlisteners in Javascript DOM

I'm trying to create a calendar, i've coded a long time ago in another langage but my company website is actually in javascript and HTML, so it is what is it. I'm having a pretty basic problem I think(...
Pablo Escobard's user avatar
0 votes
4 answers
65 views

Angular what's the best way to switch states in html display [closed]

Having to decide on two different approaches for dealing with component view between loading. By "best way" I'm talking about performance, UI less blinking (less DOM renderizations), ...
Greggz's user avatar
  • 1,891
-1 votes
1 answer
50 views

button onclicks not working on certain elements

I am making a game in JavaScript. I am trying to create a button with an onclick element and attach it to the scene. I have already done this in several places, but now the code is failing. This is ...
grevans's user avatar
0 votes
3 answers
90 views

How to execute JavaScript code on every button click?

With the current, next provided, HTML markup the page just gets reloaded, each time the button gets clicked. <h1>Refresh Me</h1> <div> <button onclick="window.location....
DSACRM's user avatar
  • 11
0 votes
0 answers
18 views

Navbar Toggle Functionality Does Not Function [duplicate]

Problem: The issue is with Javascript code that is intended to toggle the visibility of a navbar component when a button is clicked. The problem is that the elements (toggle button and navbar links) ...
Doneil Chapman's user avatar
0 votes
0 answers
23 views

CSS Animation changes position fixed <img> when applying animation to <main> element

I have a <main> tag and inside that <main> tag I have a <img> tag with position: fixed;. And as soon as I apply the animation to the <main> tag it moves the image to inside the ...
Alexander's user avatar

1
2 3 4 5
831