Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery change value of span tag - reference from another div

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!

like image 812
Nathaniel Wendt Avatar asked Jul 12 '11 16:07

Nathaniel Wendt


1 Answers

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

http://jsfiddle.net/hQqtU/

like image 71
citizen conn Avatar answered Nov 02 '22 07:11

citizen conn