-
- document.createElement (); you need to pass in a tag name as a parameter. You will create a corresponding node according to the tag name and return the node. document.createTextNode (); you need to pass in a text content as the parameter appendChild ()
Usage: parent element.appendChild( child node ).
A child of a node can be inserted before the new node
Usage: Parent node. insertBefore( new node, old node );
Replacechild(); replace child node
Usage: parent.replaceChild( new node, old node );
Removechild(); can delete a child node
Usage: parent.removeChild(child node).
InnerHTML can also be used to add dom. Generally, the two methods are combined.
e.g. city.innerHTML += " <li>GuangZhou</li> ";
Confirm (“); a prompt box with confirm and Cancel buttons will pop up. If the user clicks confirm, it will return true; otherwise, it will return false </ OL>
Read More:
- [Solved] echarts Draw Errror: echarts-d9fd185e.js:31447 Uncaught (in promise) Error: Initialize failed: invalid dom.
- Solution to build error in Vue project (error in static/JS)/vendor.xxxxx.js from UglifyJs)
- Solution to some map files in JS folder after Vue packaging (remove the map. JS file)
- [Solved] Echarts Error: Uncaught (in promise) Error: Initialize failed: invalid dom.
- [Solved] webpack Package Error: ERROR in multi ./src/main.js ./dist/bundle.js Module not found: Error: Can‘t resolv
- [Solved] Nuxt Import qrcodejs2.js / QRCode.js Error: document is not defined
- [Solved] echarts Error: Error in callback for watcher “chartSource“: “Error: Initialize failed: invalid dom.“
- Vue: initialize failed: invalid DOM [How to Solve]
- How to Solve the error: initialize failed invalid dom
- [Solved] Vue echarts Error: Initialize failed: invalid dom.
- [Solution] VUE.js Load a local image with parameters in the script
- [Solved] NPM node ERROR in main..js from Terser ChildProcessWorker.initialize Excaption
- How to Use DOM to operate CSS
- [Solved] Binding onclick event in JS: for loop: error uncaught typeerror: cannot set properties of undefined (setting ‘classname’)
- [Solved] Failed to load plugin ‘vue‘ declared in ‘.eslintrc.js‘: createRequire is not a function
- [Solved] vue.esm.js?efeb:591 [Vue warn]: Error in event handler for “click“: “TypeError: Cannot read property
- Module not found: Error: Can‘t resolve ‘core-js/modules/es.promise.js‘ in
- [Solved] This dependency was not found: * core-js/modules/es.error.cause.js in ./node_modules/_@babel_runtim
- JS bug Log Uncaught TypeError: Cannot read property ‘previoustSibling‘ of null
- [Solved] Turf.js error: uncaught (in promise) error: the solution of invalid unit