Question

I have this input button:

<input type="submit" data-toggle="modal" data-target="#NotAvailable" id="StandardProductAddToCart" name="Add to Cart" value="ADD TO CART" alt="Add to Cart" style="cursor:not-allowed;" disabled="disabled"/>

Where I'd like to fire my modal on if clicked.

My modal is:

<div class="modal fade" id="NotAvailable" tabindex="-1" role="dialog" aria-labelledby="NotAvailableLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <img class="closeModal" data-dismiss="modal" aria-hidden="true" src="http://cdnll.amleo.com/images/art/x_white.png" height="20" width="20" alt="X" />
        <h4 class="modal-title" id="myModalLabel">Not Available</h4>
      </div>
      <div class="modal-body">
        <div class="alert alert-danger"><strong>Not available for online orders. Please call 1-800-543-8995 to order; thank you.</strong></div>
      </div>
        </form>
      </div>
    </div>
  </div>
</div>

In the HTML, the Modal comes after the Input as well. Should it come before the Input?

Was it helpful?

Solution

Based upon the URL you provided, this will let you keep the disabled="disabled" attribute:

<script type="text/javascript">
    $(document).ready(function()
    {
        $('#StandardProductAddToCart:disabled').click(function()
        {
            $('#NotAvailable').modal();
        });
    });
</script>

OTHER TIPS

It doesn't matter if the modal comes before or after the button.

Your button is disabled so if you remove disabled="disabled", does it work?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top