Javascript : changing a value of element html -
how can change value of first price span using javascript
<span class="regular-price" id="product-price-27"> <span class="price">$2,699.99</span> </span> <span class="price">$2,000</span>
i've tried getelementbyclassname change tow of them
i want change value of first 1 <span class="price">$2,699.99</span>
try this, first gets outer span element, elements within class...
var outerspan = document.getelementbyid("product-price-27"); var innerspans = outerspan.getelementsbyclassname("price"); innerspans[0].innerhtml = "$xxxx";
here live jsfiddle demo
Comments
Post a Comment