The process of changing the Document Object Model (DOM). It includes adding, removing or changing DOM elements.
Questions tagged [dom-manipulation]
825 questions
-1
votes
1 answer
Adding text to a table data cell with jQuery
Why this code:
row.append($(" ").text("someText"));
...isn't working, and how can I fix it?

user169242
- 67
- 1
- 2
- 4
-1
votes
3 answers
Why is my (incorrect) DOM structure auto-corrected after JQuery DOM manipulation?
I have been searching the web for hours for this but I couldn't find an explanation or solution. So let's see if anyone can provide me with one here...
The problem I am having is that I have some "invalid" old HTML and we are currently revamping the…

Jules
- 7,148
- 6
- 26
- 50
-2
votes
1 answer
Add a click event function to a button which creates a new paragraph in box layout when onclicks on it
I've been trying to create this click event the way I described it but what I keep getting is a prompt message instead of a paragraph inside the box layout provided underneath the button.

Manuel
- 1
-2
votes
3 answers
Transforming some text into some text in PHP
As title, If I have some html
abcdeabcde
, I want to strip the style tags and transform them into html tags, so to make it becomeabcdeabcde
. How…
user2335065
- 2,337
- 3
- 31
- 54
-2
votes
1 answer
How can I detect a html element by event click without getElements...?
On one page, several Collapsibles can occur! I would like to now, if a link is activated. Get the ProductItem in which the link was activated.
I have tried it with getElementsByClass but get a complete Node-List which doesn't help me! Because there…

H.Solo
- 79
- 1
- 11
-2
votes
2 answers
jquery insert element after()
I've got the following html:
When I use
$("#api_result").text("some json"));
This leads to the following HTML code:
some jsonI've already tried to…

wichtel
- 181
- 1
- 3
- 16
-2
votes
1 answer
How can I display the highest number in an array with javascript or jquery?
In my score tracking app I'm trying to display the name (#firstPlacePlayer) and score (#firstPlaceScore) with the current leader as game goes on. I want to move only high scorer values of the h3 to my h2. My HTML:
DGrex
- 1
- 2

DGrex
- 1
- 2
-2
votes
1 answer
Using a loop to simplify DOM manipulation Vanilla JS
I have the following JS code in which I'm trying to append these elements to the DOM. I've done so, however I'm trying to figure out how to use a loop to append these to follow DRY principles. I can only use vanilla JS.
var divOne =…

brianchangdev
- 27
- 1
- 7
-2
votes
2 answers
Add an
or with createElement
How can i add an createElement(br) before and after the table? I tried it with doc.body.appendChild(p); at the end, but nothing happens. i don't know where i have to write the appendchild
function insertBlock(border)
{
var doc =…

stefan
- 55
- 5
-2
votes
5 answers
How to insert html text with text() function?
I need to change the content of an element which includes html.
I tried with this, but the html tags are printed
$('#content-sections label').text('my text a span element');
This is printed as it:
my text a span…

Jaso2970
- 149
- 2
- 7
- 12
-3
votes
3 answers
Remove CSS 'transform' using DOM Manipulation
I need to remove the following from a div's styling using DOM manipulation:
transform: translateY(-50%)
The div has the following class name: 'jsx-4186082927'
Please can someone help me with how to remove the transform CSS styling using javascript…

jessiebower
- 5
- 3
-3
votes
2 answers
-3
votes
1 answer
How to have the HTML tags wrapped in the right order in php?
I have some HTML codes which is not perfect. For example, I have
bold and italic
I want to make it to be wrapped in layers, ie.
bold and italic
How can I do that in php?

user2335065
- 2,337
- 3
- 31
- 54
-3
votes
1 answer
Appending a child to an a existing element
I am trying to dynamically build a modal form, but when I search for my modal, then create a new child, it doesn't allow me to append them. The modal is set by class, should it be an ID instead? Please don't reference w3schools; I am using that and…

Kevin Wiggins
- 544
- 5
- 11
-4
votes
5 answers
Change all
tag src attributes in html document?
Given any html document with any number of
tags, and using javascript, how can I change all the src attributes of the
tags?
For example change all src attributes in
tags from "http://example.com/somerandomimage.jpg" to…

richard
- 12,263
- 23
- 95
- 151