What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-13 00:40:15
dom create element
let myElm = document.createElement("p"); // Create a new element myElm.innerText = 'test'; // Change the text of the element myElm.style.color = 'red'; // Change the text color of the element document.body.appendChild(myElm); // Add the obje... Add solution -
TypeScript 2022-02-02 23:00:06
typescript operate with html objects
ts// 1. Select the div element using the id property const app = document.getElementById("app"); // 2. Create a new <p></p> element programmatically const p = document.createElement("p"); // 3. Add the text content p.text... Add solution -
Html 2021-11-03 00:35:11
create node in javascript
<div id="div1"> <p id="p1">This is a paragraph.</p> <p id="p2">This is another paragraph.</p> </div> <script> // Create <p> element var para = document.createElement(&q... Add solution -
Javascript 2021-10-14 03:07:04
js append en tête
var parent = document.createElement("div"); var p = document.createElement("p"); var span = document.createElement("span"); parent.append(p); parent.prepend(span); console.log(parent.childNodes); // NodeList [ <span>, ... Add solution -
Other 2021-10-06 10:35:02
document create element
let myElm = document.createElement("p"); // Create a new element myElm.innerText = 'test'; // Change the text of the element myElm.style.color = 'red'; // Change the text color of the element document.body.appendChild(myElm); // Add the obje... Add solution -
Javascript 2021-09-25 20:04:06
how to create a paragraph in javascript dynamically
<html> <head> <title>t1</title> <script type="text/javascript"> function addNode() {var newP = document.createElement("p"); var textNode = document.createTextNode(" This is a new text n... Add solution -
Javascript 2021-09-13 17:48:01
javascript virtual assistant scrip[t
const startBtn = document.createElement("button"); startBtn.innerHTML = "Start listening"; const result = document.createElement("div"); const processing = document.createElement("p"); document.write("<body&... Add solution