Most voted "dom" questions
DOM (Document Object Model - Document Object Model) is a W3C specification for a platform and language independent interface, where one can dynamically change and edit the structure, content and style of an electronic document, allowing the document to be later processed and the results of that processing, incorporated back into the document itself.
Learn more…268 questions
Sort by count of
-
3
votes2
answers1419
viewsAttach file . js inside other . js
Is the following: I have an index.html page where the user selects a certain amount through radio input. Clicking on GENERATE runs a function where via Document.write a form is created according to…
-
3
votes3
answers2621
viewsHow can I display any Javascript object as a string?
If I have any object like new MeuObjeto(), and I want to string all its internal properties. How can I do this? When I use alert(new MeuObjeto()) the result is [object Object]. But I want the…
-
3
votes1
answer141
views -
3
votes1
answer853
viewsWhat is DOM Parser?
Reading about regular expression I saw a recurring term, DOM parser, and I had doubts: What is DOM Parser? How it works? Every language has?
-
3
votes1
answer732
viewsHow does the web page rendering process work by the browser?
I know there is a DOM tree, but I don’t know how the rendering works. I know that learning this is important.
-
3
votes1
answer621
viewsPHP Regex remove IMG attributes and change SRC
I have the following string with the html: teste = "<img src="image/teste.jpg" alt="" width="32" height="32"> <p>teste</p> <img src="image/teste2.jpg" alt="" width="132"…
-
3
votes2
answers516
viewsHow to return a part of a string (an html element) in php?
I am making a "technical resource" to be able to return the status of the SEFAZ servers of issuing tax notes using PHP. For this, I have until now the code below: function get_content($URL){ $ch =…
-
3
votes1
answer533
viewsview HTML element placed on the page using DOM - Javascript
Class Piso and class Consola /** * Classe Piso * contem um numero piso */ function Piso(id) { this.id = id; } /** * Classe Consola * contem uma lista de pisos */ function Consola(nome) { this.nome =…
-
3
votes1
answer76
viewsHow to know if the past object is a DOM element?
I’m working with functions I must pass on (Mandatorily) an element GIFT. This function will work with the properties of this DOM element. Example function changeValue(elem, value){ elem.value =…
-
3
votes1
answer860
viewsManipulate DOM at angle 2
I’m passing a web system that has Jquery to Angular 2. I have a button that when clicked it adds two inputs and together with them is created a button to delete these inputs. ( follows the code in…
-
3
votes3
answers66
viewsBy which means one can remove the dynamic cell inserted in the HTML table
Script var opt = document; function inserirLinha(id) { var newRow = opt.createElement('tr'); newRow.insertCell(0).innerHTML = '<input type="button" value="X" onclick="removeLinha(this)" />';…
-
3
votes1
answer78
viewsHow to apply opacity to a DOM element - createImage(); - through a javascript editor?
I’m using P5.js - a javascript library - to capture images from a news API. I would like these images to be superimposed, but with opacity, so that the images merge. I’m not being able to apply…
-
3
votes2
answers1254
viewsAssign value to a specific input
Good morning person, I’m having trouble coming up with a code. I have several inputs that are created dynamically. I need to take the ID of the specific element to change its value. EX: I have the…
-
3
votes1
answer370
viewsHow to validate an array if it has objects inside it or not? React JS
I have a code made using React JS and it works like this, I have a select component, and this is reused several times and the information it receives always comes from an array, only now I need to…
-
3
votes3
answers757
viewsIs there a command or function in Javascript that controls the screen update before the loop ends?
Just one example: <script> for (var i=0;i<10;i++) { //Inicia loop for para contar de 0 até 9 var t=0; // inicia variável t com valor 0 while(t<1000000) { //inicia loop enquanto t for…
-
3
votes1
answer34
viewsTransform 3 similar functions into one
In my project, I have very similar functions, with the same intention, however, as it is a DOM class exchange function (classList.replace), I ended up making a very repetitive code, and I’d like to…
-
2
votes2
answers11882
viewsCalling function with onclick
Guys I can’t call a function using onclick, calling it straight from the html tag comes normal but if I call unobstructive way without chance I’ve already read several Docs tried n ways and nothing…
-
2
votes2
answers1632
viewsHow to get the <a> tag inside a <DIV, using XPATH?
I’m trying to get the data from a DIV that contains the following structure: <div class="item" style="height:273px"> <a href="/arapiraca/anuncios/detalhes/159695-honda-cg-150-2008">…
-
2
votes2
answers784
viewsHow to implement an SVG?
Well, the SVG is very important to the web, since it’s vector and I can resize it at will. It is an image format written in xml and is one of the image standards for web. But, when I try to…
-
2
votes3
answers598
viewsCheck if there was POST with Javascript
I have a singlepage application, and would like to monitor the POST for a webservice. When I send the information it will remove the loading. ex: scope.deleteFile = function (fileId,index) {…
-
2
votes1
answer68
viewsOption value change of the select element
I’m trying to add an option to a select: function add(){ var opt = document.createElement("option"); opt.value = "0101"; opt.text = "foo"; } That code works. My question is why when I remove double…
-
2
votes1
answer1307
viewsDifficulties connecting Javascript with HTML
A few months ago I took a course to insert myself in the job market as "Front End", I learned what was necessary, but now to put into practice Javascript is complicated, because in theory I know a…
-
2
votes1
answer8726
viewsHow to get the value of a list of ckeckboxes with jquery?
I’ve tried the following: <input name="chklista" id="chk01" value="01" type="checkbox" />01<br /> <input name="chklista" id="chk02" value="02" type="checkbox" />02<br />…
-
2
votes1
answer69
viewsHow to obtain a limited number of occurrences with DOM?
I’m parsing from a website, I want to get some data from it, the data is structured as follows: <div class="interesses"> <span class="tipo" >Tipo 1</span> <span class="tipo"…
-
2
votes1
answer126
viewsHow to detect changes in the DOM (Document Object Model)
With every change in GIFT (Document Object Model), whether it is an inclusion, exclusion or even a modification in some element I would like to perform a function, there is some "simple" way to do…
-
2
votes1
answer4632
viewsRead A tag that sits inside another in an . xml file with DOM API
Take data from a tag and right after take data from a daughter tag. For example, I have 2 tags that repeat across the entire document, and I need to take data from both: <teste:dadosLote>…
-
2
votes1
answer73
viewsjavascript does not create html element and does not add to the page
I’m starting at the javascript and wanted to create html elements dynamically but when you load the page it goes blank and does not add the elements code below: function add (){ var texto =…
-
2
votes2
answers185
viewsRead XML file with only one Parent Node
I need to import an XML file that has the following structure: <?xml version="1.0" encoding="UTF-8"?> <Registos>3</Registos> <Socios> <id>1</id>…
-
2
votes2
answers2906
viewsHow to add a class to an HTML element via Javascript. In my case, I need to add a class to the H1 element below
I need to add a class to the H1 element var div = document.createElement("div"); var h1 = document.createElement("h1"); var p = document.createElement("p"); h1.textContent = "Me Ajuda";…
-
2
votes2
answers197
viewsWhy window.innerheight/ window.innerWindow does not work with Document.getelementsbytagname('canvas');
Why doesn’t it work? const canvas = document.getElementsByTagName('canvas'); canvas.width = window.innerWidth; canvas.height = window.innerHeight And that’s what? const canvas =…
-
2
votes1
answer193
viewsJavascript click the button and calculate a difference
I need the result of the transformation to appear when I click the Calculate button. HTML <div id="principal"> <form id="form"> <input id="valorX" type="text" size="15" />…
-
2
votes2
answers104
viewsbootstrapValidator.js with jsf does not work
My validation script using bootstrapValidator.js <h:outputScript library="primefaces" name="jquery/jquery.js" target="head" /> <h:outputScript library="primefaces"…
-
2
votes2
answers63
viewsToggle the text of an element with each click
I’m willing to keep changing what’s written in the DOM as a loop. But when he goes to the end of the teste1 and calls the teste, should not start the function again teste?…
-
2
votes4
answers177
viewsHow to get the entire HTML of the last Fieldset into a dynamic page?
I have a div where multiple are added fieldsets and just below a hr: The content of div is dynamic and may have 3 or more fieldsets. In my code I could only get the contents inside the first. How…
-
2
votes1
answer556
viewsDomdocument::loadHTML() Error
Well I have the following controller where I get a twitter user’s information by username using DOMDocument::loadHTML() public function info($user = false) { if ($user === false) {…
-
2
votes1
answer67
viewsIs it possible to get the value of the background-image attribute through xpath?
I have the following structure: <div class="xGh" style="background-image: url('name_file.jpg');"></div> Where I need to capture: name_file.jpg I tried to use the solution presented in…
-
2
votes2
answers923
viewsWhat is the difference between querySelectorAll() and getElementsByClassName()
Apparently these two functions are similar, which one is more performative? Which one should I use? What is the difference between the two? Document.querySelectorAll() function funDOM() { var x =…
-
2
votes2
answers347
viewsTransform a variable value into a paragraph
I want to know how to, instead of sending the result of the function to Alert, create a paragraph, for example. Remembering that this doubt is to help me with future projects, so I’m putting a very…
-
2
votes1
answer385
viewsHow to handle a span element using pure JS
My question in this exercise is how to keep my point total fixed, because whenever the function is executed the value changes and automatically it returns to 100.So how should I manipulate this span…
-
2
votes2
answers788
viewsKnow when you hear changes in DIV with Javascript
Hello, good morning. I need to compare a change in DIV1’s daughters to make a notification. This way I did may not be the best, I’m still learning. <div class="div1"> <div class="filha">…
-
2
votes1
answer96
viewsTotalize column values of an HTML table with decimal result
I need to display the total result by summing the values that contain the value column: var linha=document.getElementsByClassName("calcular"); var…
-
2
votes1
answer110
viewsJS of a document working within iframe html
Good afternoon, you guys! I have my site for example, which has the normal page that every page has, html, head, body, etc... Inside this my page, has an iframe, this iframe pulls another html from…
-
2
votes2
answers648
viewshow to access the class array with jQuery? Take the second class of an element
I’m listing the icons from a list on console.log() they are displayed, however I want to capture only the second classes of icons in a variable, but I don’t know how to access with jQuery the second…
-
2
votes1
answer82
viewsBrowse and retrieve DOM objects via getElement without using Webbrowser
Is there any way to browse web pages, create requests like .Document.getElementById(" ") without the need to use the component WebBrowser() on my form? WebBrowser browser = new WebBrowser();…
-
2
votes2
answers164
viewsuse fetch api to present user cards, innerHTML overwrite cards
In this code I access a fake Rest api, I take the data, step for json, but when it comes to presenting the cards of the users I cannot find a good way to do this, innerHTML erases all the cards and…
-
2
votes1
answer85
viewsHow to take the links of a Nav with Javascript and add a class?
I got the following nav: <nav> <ul> <li><a href="">1</a></li> <li><a href="">2</a></li> <li><a href="">3</a></li>…
-
2
votes1
answer71
viewsIs there any way to break every word of a span text into children?
Imagine that I identify within a text a span element that starts and ends with the class "color-green": <span data-id="1" class="cor-verde">O texto está assim <strong>parte em…
-
2
votes2
answers36
viewsWhy is an HTML element found only in "onload"?
If I put the code free, without being inside the onload, the variable button flipped null. My current code works, but I wanted to know why it doesn’t work without being inside the function onload.…
-
2
votes0
answers41
viewsHow to style components nestled with Shadow DOM?
I have 2 nested web components that use Shadow DOM. The first, my-component, only render the second component: <my-another-component part="my-another-component" /> And the second,…
-
1
votes1
answer62
viewsDecode characters from email
I’m trying to import data from an email and I can get the data, but some characters come in an encoding that I didn’t find how to convert, for example. Goioer=C3=AA Paran=C3=A1 I tried utf8_decode,…