Jquery .html到.val

I have this in a form:

<span name="totalprice" id="totalprice">0</span>

and this jquery code:

$('#totalprice').html((data * $('#numlic2').val() - (data * $('#numlic2').val() * $('#persent').val() / 100)).toFixed(2));

i recive data from php and replace it in the span field replacing the 0. I want to post the value of the totalprice but when i post it its blank so i think i have to assign the .html to .val am i wrong?

how can i do that in jquery?

You place 0 as default or initial value in span and you said you are getting blank in span then it mean something went wrong with you PHP code. Your PHP returns nothing.

jQuery html() is ok to replace the inner HTML of an element. You can use text() to change the text value of an element.