I want to use Vanilla JS instead of the below jQuery code to get the attribute value of the selection.
$("#PartnerTypeID").find(':selected').attr('data-id');
How is this possible?
document.getElementById("PartnerTypeID").addEventListener("change", function() {
console.log(this.getAttribute("data-id"))
});
<select id="PartnerTypeID" name="PartnerTypeID" placeholder="Select...">
<option value="">Select...</option>
<option data-id="hospitals" value="1">Hospital</option>
<option data-id="daycare" value="2">Daycare</option>
</select>