Bootstrap select pass value with disabled
Asked 10 September, 2021
Viewed 280 times
  • 0
Votes

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.

I'm not able to get the data attribute from a button element.

<button
 class="btn btn-solid navigate"
 value="2"
 data-productId={{$product->id}}
 id="size-click"
 >
 Next
</button>

Then I attempt to get it like so:

$("#size-click").click(() => {
 let width = $("#prod-width").val();
 let height = $("#prod-height").val();
 var prodId = $(this).data("productId");

 console.log('this is prodId');
 console.log(prodId);

 const data = {
      prodId: prodId,
      step: 'Size',
      width: width,
      height: height,
    }

    postDataEstimate(data);

  })

I'm also trying this:

var prodId = $(this).attr('data-productId');

Can you let me know what I'm missing?

0 Answer