I have used the below JavaScript code to get the sum value of list column and the display it in a div.
<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("Effort");
function Effort(){
var effortSpent = document.getElementById("aggrWPQ3").lastElementChild.innerText;
var IntEffortSpent = effortSpent.substring(4);
var results = parseInt(IntEffortSpent) + 0;
document.getElementById("DIV").innerHTML=results ;
};
</script>
This code works when there is some item in the list and it is able to get the sum value and display it in the div but when there is no item in the list,I want it to display 0 in the same div.
what is needed to be done?