I'm having hard time in to getting the data attribute set to select option on bootstrap selectpicker .
I tried:
$('.selectpicker').on('changed.bs.select', function (e) {
var selected = e.target.value;
console.log("value : ", selected ); // gives selected value
console.log("data attribute: ", $(e.target).data("price"));
});
data attribute always returns undefined
what wrong I'm doing here ?
e.target
not being what you expect,console.log(e.target)
to confirm, or the element doesn't have the attribute assigned, spelled or specified as you expect. Please post the actual markup of the relevant DOM in a Minimal, Complete, and Verifiable example using the code snipped feature. – Misdirection