Javascript – Jquery change value of span tag – reference from another div

htmljavascriptjquery

So my html code is:

<div class="product-details">
    <div class="availability in-stock">
          Availability: <span>In stock</span>
    </div>
</div>

I would like to use Jquery to change the span value of "in stock". I am somewhat new to Javascript and Jquery, so how would I change that span value without it having an id to reference.

Many thanks in advance!

Best Answer

$('.in-stock span').html("your new string");

http://jsfiddle.net/hQqtU/