Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using javascript to read value from itemprop

Tags:

javascript

Is it possible the read the price using the javascript

<span id="product_price_00873">
<span itemprop="price">178.00</span>
</span>

I just want to price 178.00. I can only using javascript.

Any suggestions will be appreciated.

like image 648
jbcedge Avatar asked Mar 09 '12 01:03

jbcedge


1 Answers

If you have the product element in product and you're using a modern browser, this should work:

var price = product.querySelector('[itemprop=price]').textContent;
like image 182
icktoofay Avatar answered Sep 24 '22 14:09

icktoofay