Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript Hide a Button based on item Stock

new2this

New Coder
I have a website I sell products on. Is there anyway to hide a button when the product is out of stock? Maybe some kind of script that finds text "item out of stock" and then makes the "Make Offer" button hidden. Here is the code I have now for the Make Offer Button.


<div class="DetailRow">
<a class="btn" style="cursor: pointer"
onclick=" window.open('http://www.website.com/make-an-offer/','',' scrollbars=yes,menubar=no,width=550, resizable=yes,toolbar=no,location=no,status=no')">Make Offer</a>
</div>
 
the product page does not show the inventory value at 0. Below is what it displays. So how do I take that value from those messages?


<div class="OutOfStockMessage">
<div class="CurrentlySoldOut">
<p>Item out of stock.</p>
</div>
</div>
 
You don't Your stock level should be in a database. You get the level using PHP or something similar and send it to the page. If you generate the page using PHP it would make things easy for you.
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom