Availa...">

JQuery span tag change value - link 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 value of the range "in stock". I am somewhat new to Javascript and JQuery, so how would I change this range value without using an identifier for the link.

Thank you very much in advance!

+6
source share
3 answers
 $('.in-stock span').html("your new string"); 

http://jsfiddle.net/hQqtU/

+17
source
 $('.product-details .availability span').text('foo'); 

Fiddle: http://jsfiddle.net/maniator/EryVF/

+6
source

What you are looking for is either text() or html() , for example:

 $('.availability span').html('This is what you want to change it to'); 

Here is an example: JsFiddle Demo

+3
source

Source: https://habr.com/ru/post/892595/


All Articles