OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Recreate a HTML element with JavaScript

  • Thread starter Thread starter Paulo1706
  • Start date Start date
P

Paulo1706

Guest
a simple question: Based on the codes below, I would like to ask a question, is it possible for me to rewrite the elements using Javascript that were inside "person-infos" after having them removed by Javascript?

Code:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Testes</title>
</head>
<body>
  <div class="person-infos">
    <img class="photo">
    <div class="name"></div>
    <div class="age"></div>
  </div>

  <script src="testes.js"></script>
</body>
</html>

Code:
const infos = document.querySelector(".person-infos")
const nomeCandidato = document.querySelector(".name")
const partidoCandidato = document.querySelector(".age")

const elementsInfo = infos.children

infos.remove()

<p>a simple question: Based on the codes below, I would like to ask a question, is it possible for me to rewrite the elements using Javascript that were inside "person-infos" after having them removed by Javascript?</p>
<pre><code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Testes</title>
</head>
<body>
<div class="person-infos">
<img class="photo">
<div class="name"></div>
<div class="age"></div>
</div>

<script src="testes.js"></script>
</body>
</html>
</code></pre>
<pre><code>const infos = document.querySelector(".person-infos")
const nomeCandidato = document.querySelector(".name")
const partidoCandidato = document.querySelector(".age")

const elementsInfo = infos.children

infos.remove()
</code></pre>
 

Latest posts

J
Replies
0
Views
1
jbowerbir
J
Top