Questions tagged [insertadjacenthtml]

60 questions
1
vote
2 answers

LocalStorage data appearing in console but not in the DOM

I am currently building a to-do list app and I have already saved the data using the localStorage API. The desired data, however, appears in the console whenever I console.log it but it still doesn't save in the DOM. I also added the getItem()…
1
vote
1 answer

Id is not displaying in insertAdjacent Method in JavaScript

Everything is working fine but in the last line my id is not displaying. It's displaying like %id% not the actual data. PROBLEMS I want to start the id from 1 but it's starting from 0. I can't understand how to make it start from 1. Id is not…
Azeez
  • 368
  • 2
  • 10
1
vote
1 answer

Why does inserting an newly created element to an existing element parses [Object HTMLElement]?

When trying to place a value to an already existing element without using document.createElement() the browser displays the desired result, however, when I do it using document.createElement() I get [Object HTMLElement] but no error in the…
1
vote
1 answer

ajax reload ul/li div and retain event listeners (other than insertAdjacentHTML)

Goal: reload only the div after ajax calls (add or remove tags) without losing event listeners on the reloaded div. Using insertAdjacentHTML does not seem optimal. Front-end: I have a sidebar with ul/li for tags. There's a modal to add/create tags;…
farhang
  • 407
  • 1
  • 5
  • 13
1
vote
0 answers

Save items to dom using insertadjacentHTML

I am currently making a small to do list application. I am adding new to-do items using insertadjacentHTML (as shown below), but after refresh they disappear. What would be the best way to save these items to the DOM permanently. I plan on using…
barskyn
  • 353
  • 1
  • 3
  • 13
1
vote
1 answer

Perfect scrollbar not functional with content loaded dynamically using insertAdjacentHTML

I am trying to dynamically load some links from an array(JSON encoded values) as a list inside a div. In my real application this array comes from PHP. I am using insertAdjacentHTML('beforeend', "link content") to set the content. To style the same…
1
vote
1 answer

insertAdjacentHTML not adding before beforeend

So I have been working on the script that when a user clicks the + button it adds a new button before the addnew div. From my understanding I have followed the right setup to set up a insertAdjacentHTML…
RussellHarrower
  • 6,470
  • 21
  • 102
  • 204
0
votes
1 answer

Unable to select element after inserting it using insertAdjacentHTML

I have this piece of code wherein I am making an API call and fetching some data and then inserting it onto the page so as to create an accordion style display panel. The rendering works fine but I am not able to select any element which I have…
0
votes
1 answer

How to filter and inserted element in html with JavaScript

I have a general clothing catalog made in js and I insert it to my html with insertadjacenthtml with an id but I want to filter it when a button is pressed. If I press the button "hombre"= I want to show only the elements of my array with the…
0
votes
0 answers

Insert (changeable) html into modal using javascript’s ES6 Classes

I need some help implementing a javascript feature on this website that I’m developing. The website have a section with some pictures of different persons. I want to open a modal with content related to that specific person, every time one clicks a…
Henrique
  • 1
  • 1
0
votes
1 answer

Disadvantage of using insertAdjacentHTML to make HTML Component

Assuming system has following code in each index.html and module.js, index.html ...