I am trying to write a simple script which goes div by div and changes the text of that div to "Sold out". However, the .text is returning [Object, Object] instead of "Sold out". I will be very grateful if someone can tell me what I am doing wrong. Thank you in advance.
Best regards, George
$(function Store(){
Status = "Sold out";
$("div").each(function(){
$(this).contents().not($(this).children()).text(Status);
alert($(this).contents().not($(this).children()).text(Status));
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="Wallet">
<div class="Price">
10.00$
</div>
<div class="Price">
20.00$
</div>
<div class="Price">
30.00$
</div>
</div>