Hi Guys simple question (but failed to do this :( ). Just want to add all the numbers in <li>
PLeae check fiddle here http://jsfiddle.net/6j0xq49v/1/
Or you can check my code below
<ul>
<li>2</li>
<li>2</li>
<li>2</li>
<li>2</li>
<li>2</li>
<li>2</li>
</ul>
<button>Click</button>
<div class="total"><div>
SCRIPT
$('button').click(function(){
var thistext = 0;
$('ul li').each(function(){
thistext = $(this).text();
thistext += parseInt(thistext)
alert(thistext)
})
})
Please help me guys Thanks in advance :)