Category : appendchild

I can’t get an image positioned properly from JavaScript using img.style.top and img.style.left, it’s always showing on top left, unless I use the CSS. Please help this newbie. <—css file—> .imgTable { position: relative; z-index: -1; } .imgDeal { position: absolute; transform: scale(.5); //top: 60px; // — this works — //left: 470px; // — this ..

Read more

I am trying to append a new li item along with the close element to my list in this to do list web-project.Why isn’t it working? Here is my js code: addbutton=document.getelementbyid("addbutton"); > addbutton.addeventlistener(‘onclick’, addtolist); function > addtolist(e){ const ultag=document.queryselector("#myUL"); > const myinputvalue=document.getelementbyid("myinput").value; > const newli=document.createelement("li"); newli.innerHTML=myinputvalue; > ultag.appendchild(newli); > const addedx=document.createelement("span"); addedx.innertext="x"; > added.classname="close"; ..

Read more

I’m writing a userscript and need to make it so any iframe appended to the DOM with document.body.appendChild()‘s content document has the hidden getter set to always return false. I can change the getter with: iframe.contentDocument.__defineGetter__("hidden",()=>false) I need this to modify elements before they’re added to the DOM, so that var i = document.createElement("iframe"); i.sandbox ..

Read more

First, below is the desired result without any JavaScript added * { box-sizing: border-box; margin: 0; padding: 0; } html, body { height: 100%; } body { display: flex; justify-content: center; align-items: center; } svg { transform: scale( 2 ); border-radius: 0.25rem; width: 100px; height: 100px; background-color: rgba( 95%,95%,95%,0.5 ); fill: #444; } <svg> <path ..

Read more

I know it’s possible because I’ve seen code that seemed to do this. I don’t understand why it works. Here is a portion of the code in question: this.el = document.getElementById(‘tasks’); this.tasks = []; //the following function displays all results or the ‘R’ead in CRUD this.FetchAll = function(){ var data = ”; if(this.tasks.length>0){ for(let i ..

Read more

Can someone tell me why this JS function is working on Firefox 89.0.2 but not into Chrome (Edge 91.0.864.64)? function getRandomImageJson() { var script = document.createElement(‘script’); script.src = url; particle.appendChild(script); particle.removeChild(script); window.setTimeout(getRandomImageJson, interval); // loop } Console says: Uncaught TypeError: particle.appendChild is not a function at getRandomImageJson site: http://storytelling.pics/ or https://editor.p5js.org/loranto/full/bMgoCPHRE[2] Here all JS: <!– ..

Read more

I want to make moving effect or animation or transitions an element before append Child . Append Child working fine but I can’t make moving effect or animation or transitions an element before append Child . Please any one can help ? function checkedmove(data) { var productName = data.getAttribute(“name”); var productElement = document.createElement(“li”); productElement.setAttribute(“name”, productName); ..

Read more

I was building a chrome extension that modifies the content on a Youtube video page. The following is my code: manifest.json { "name": "Chrome Demo", "description": "Some Cool Description", "version": "1.0", "manifest_version": 3, "content_scripts": [ { "matches": ["https://www.youtube.com/watch*"], "js": ["temp.js"], "run_at": "document_end" } ] } temp.js let observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => ..

Read more