Jquery math addition -
i'm trying add through jquery event , i'm getting nan. missing?
<input type="hidden" id="skillcount" name="skillcount" value="3" onchange="valueadd(this)"/> function valueadd(ok){ var value=parsefloat($(this).val())+1; }
the code should be:
function valueadd(ok){ // "this" inside here refers window var value=parsefloat(ok.value)+1; }
the inline onchange anonymous function:
function() { //"this" inside here refers element valueadd(this); }
so "this" argument gets called "ok" in valueadd scope. others have stated, though, want use jquery's bind "this" inside of valueadd point element.
Comments
Post a Comment