-3
Well, I need the variable "_som" to return a sum instead of concatenating
_eb.addEventListener('click',function(){
if (_mon > d.v_eleitor){
var md = _mon - d.v_eleitor;
k.innerHTML="$"+md+",00";
_mon = md;
_jj.innerHTML = d.x_eleitor;
if (_pp == ""){
_pp.setAttribute("value", d.x_eleitor);
} else {
var yy = _pp.getAttribute("value");
var _som = eval("yy + 15");
alert(_som);
_pp.setAttribute("value", _som);
}
} else {
alert(d._eleitor);
}
});
I need it to return the sum in the "value" attribute of this progress bar:
<progress id="progress_bar" value="" max="1000">
Forehead with
var _som = parseInt(yy, 10) + 15;
. If you have decimal values, test withparseFloat
...– Sergio
Explain better what the code does and assemble an example with jsFiddle. This makes the question clearer and easier to help you.
– Sergio
@He came from the Code Golf... ;)
– Daniel
It’s simple, you don’t need to know what variables do, I just need them to disappear instead of concatenate
– ariel
@Ariel to what you asked, Sergio’s comment already responds.
– Renan Gomes
This is also an option var yy = +_pp.getattribute("value"); var _som = yy + 15;
– Moykn