I need to show the sum of the values which is coming from two dynamic div but below I mention the static version of the div. Anyone can help me to solve this tiny jquery puzzle :
$(document).ready(function(){
arr = $('#cover div p').map(function() {
return $(this).html();
});
for (i = 0; i < arr.length; i++) {
var res = parseInt(arr[i]);
var res = res+parseInt(arr[i]);
$('#resultTotal').html(res);
}
});
.slider
{
background-color: blue;
color:white;
padding: 5px 10px;
margin: 10px;
}
#resultTotal
{
background-color: green;
padding: 20px 10px ;
margin: 10px;
color:white;
}
<div id="cover">
<div class="slider">
<p class="content">100</p>
</div>
<div class="slider">
<p class="content">200</p>
</div>
</div>
<div id="resultTotal"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>