I want to get the exact HTML of the element I want
like if I have this:
<div class="input">
<input type="number" id="nanometer" autocomplete="off" class="field" placeholder="nm" oninput="exchange()">
</div>
I want to get that exact HTML code in my JavaScript:
var nano = document.getElementById("nano")
and now I expect nano to be:
<input type="number" id="nano" autocomplete="off" class="field" placeholder="nm" oninput="exchange()">
and for my work, I have to make it duplicate itself like this:
<input type="number" id="nano" autocomplete="off" class="field" placeholder="nm" oninput="exchange()">
<input type="number" id="nano" autocomplete="off" class="field" placeholder="nm" oninput="exchange()">
by this code:
document.getElementById(nano).outerHTML += nano
but it wont work
var html = document.getElementById("nano").outerHTML? isn't it? But remember,idmust be unique, if you duplicate the element with same id, you'll have invalid HTMLvar html = document.getElementById(nano).outerHTMLgets the whole html codes in the <div> bu i want it to get just it self, and i doesnt matter if the id gets copied, because if i make the javascript code o it, i have plans to change the ids in another copies