Ich habe diesen Code:Erste-Attribut aus HTML Mit .getAttribute() fehlgeschlagen
HTML
<select disabled class="kurir full-width" data-init-plugin="select2" name="kurir" data-productid="316">
...
</select>
jQuery
$(".kurir").change(function() {
var productid = $(this).getAttribute('data-productid');
alert (productid);
});
Warum kann ich nicht 316
aus data-productid
? Was habe ich hier verpasst?
Vielen Dank.
Verwendung '.attr ('data-productid');' – guradio