my snippet which am developing has four inner htmls with javascript now my question is can we get all these data from all and add(if integer) them or concatinate(if string) and dispaly in another div tag
<script>
document.getElementById('one').innerHTML = 10;
</script>
<script>
document.getElementById('one').innerHTML = 20;
</script>
<div id="one">
</div>
<div id="two">
</div>
<div id="three">
now here i want the sum of the both one and two
</div>
anyone help me is it possible or not if yes how to do it…
This would set the
<div id="three">innerHTML to sum of<div id="one">and<div id="two">. If you need to just concatenate (you mention both concatenate and sum in your question, so it’s not clear which one you actually need) two innerHTML strings then remove theparseInt();functions.