Questions tagged [insertadjacenthtml]
60 questions
0
votes
1 answer
How to show arrays elements with map method
I want to show in the paragraph all elements from array named monday. How to change the code to fix it? and cany You help to understand how to join this methods?
Regards
`
let mondayList = document.querySelector("firstPastList");
let monday =…

code grafo
- 3
- 4
0
votes
0 answers
JS event listener doesn't work on elements after insertion
I'm changing document language from Arabic to English by setting the dir attribute to rtl,
with that happening I'm hiding the parent div date-and-language and adding it to another place in the document using insertAdjacentHTML, the problem with this…

aasem shoshari
- 25
- 4
0
votes
0 answers
How to add border to DOM element from the component logic using insertAdjacentHTML?
I am trying to add a border of 2px solid from my component logic, meaning, from the component.ts.
Could you help me ? Thank yous for your time ?
I am expecting to just frame a simple div.
I tried using insertAdjacent as in this stackblitz project…

Jean De La Hone
- 23
- 1
- 5
0
votes
1 answer
Appended div does not have functionality
My async function pulls info from web and appends to page using displayTickerResults() using insertAdjacentHTL. The HTML insert is using class names and structure that is the same as existing div's already on page. The renderButts() function is…

fortytongorilla
- 3
- 2
0
votes
2 answers
javaScript insetAdjacentHTML() not working
all
I was trying to use insertAdjacentHTML() to create elements and add events by using addEventListener().I don't think there was a logical problem in my code below, but it was not working (not console.log()ing)
My code was as below:
const…

Hai Na Zheng
- 167
- 3
- 11
0
votes
1 answer
How can I remove an HTML element that has the data type string in javascript?
I am trying to redesign a quiz template that only allows users to choose one answer before the other options are disabled. The user should be able to choose another answer (erasing the first) before submitting.
I can remove the highlighted color…

Raphael Jones
- 1
- 2
0
votes
1 answer
insertAdjacentHTML not working with created element
I want to display a table after an h1 with an id of pageHeading.
The HTML for the h1 is hardcoded:
Table
const pageHeading = document.querySelector("#pageHeading") The table is created with Javascript: const table =…
Naj
- 205
- 1
- 8
0
votes
0 answers
How to give an element position of fixed when using insertAdjacentHTML
I'm injecting an element onto the body of my HTML from the script using document.body.insertAdjacentHTML. Once I do it the element pops up but is at the very top of the page, the method only has 4 different positions to choose from so I want to know…

Hitman DD
- 47
- 1
- 11
0
votes
0 answers
function equivalent to insertadjacentelement('beforebegin', elm)
I am not able to use insertAdjacentHTML to insert deleteElement "before begin" because argument of type HTMLElement is not assignable to parameter of type String.
deleteElement cannot be pass as an argument to insertAdjacentHTML because it is a…

user21
- 1,261
- 5
- 20
- 41
0
votes
0 answers
is it possible to render a function inside insertadjacentHTML parameter?
i am trying to reuse a function that will render contents anywhere i use it outside of it's birthplace.
i have this code which fetches data from API
const showData = async function(){
try{
const res = await fetch(url);
const data =…
user14868233
0
votes
1 answer
Are there any security risks with using insertAdjacentHTML when wanting append HTML to a document?
I have recently found out that using setInnerHtml is not good practice as there are plenty performance and security issues associated with it. So I am wondering whether replacing setInnerHtml with "insertAdjacentHTML" is fine?
Also, how should I go…

Alexandros Kourtis
- 539
- 2
- 6
- 20
0
votes
0 answers
Delete Firebase entries onclick in a button from a insertAdjacentHTML
I am trying to delete some entries in FirebaseDatabase and I am having problems. The console returns the error Uncaught SyntaxError: Invalid or unexpected token only in the first entry, and for the others returns Uncaught ReferenceError:…
0
votes
1 answer
Create a div for each parent?
I need to wrap all the childrens of the parent with a div. In the example below I managed to put a div tag after each parent but how do I put an end /div tag at the end of the chidrens.
I tried with document.createElement, and now with…

maja
- 177
- 1
- 13
0
votes
1 answer
document.currentScript.parentNode.insertAdjacentHTML doesn't work in ajax call
We have a component that contains the following script block to insert a js observable image that gets updated when it comes into view: