2021年4月3日星期六

how to make text value to number from the span

I want to make the text value to the number so I can put some calculations in the script.

<p>       <span class="shopdetailInfoName">CONSUMER</span>       <span class="shopdetailInfoCont">           <strike><!--/number/price_consumer/-->               <span class="won">$</span>           </strike>       </span>  </p>  

so as you can see the price value coming from this <!--/number/price_consummer/--> which website developer make it is work.

I try to make some script like this ->

var a = document.getElementById ('shopdetailInfoCont');  

to bring the price value as a number but .shopdetailInfoCont include "," and "$" so it bring that value to text not the number.

How can I bring the value as the number?

as a result, I want to make like this

(ex ) - product price : 45.50 $ )  

if you apply -20$ discount, price will be 25.50$

any help will be so appreciated thanks!

https://stackoverflow.com/questions/66930560/how-to-make-text-value-to-number-from-the-span April 03, 2021 at 07:19PM

没有评论:

发表评论