JSFiddle - React, Tailwind, and code Playground

by samando27

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="quantity">
  <div class="quantity-select">
    <div class="entry value-minus">&nbsp;</div>
    <div class="entry value" id="quantity" name="quantity"><span>5</span></div>
    <!-- By replacing the above div with: <input type="number" class="form-control" id="quantity" name="quantity"  min="0"> the quantity will work -->
    <div class="entry value-plus active">&nbsp;</div>
  </div>
</div>

<button type="submit" onclick="add_to_cart();return false;" class="add-to item_add hvr-skew-backward">Add to cart</button>

JavaScript

function add_to_cart(){
  var quantity = $("#quantity span").html();
  var available = jQuery('#available').val();
  
  console.log(quantity);
}