jQuery: get data attribute
1. Try this: .attr()
$('.field').hover(function () { var value=$(this).attr('data-fullText'); $(this).html(value);});
DEMO 1: http://jsfiddle.net/hsakapandit/Jn4V3/
2. Try this: .data()
$('.field').hover(function () { var value=$(this).data('fulltext'); $(this).html(value);});
Change IDs and data attributes as you wish!
<select id="selectVehicle"> <option value="1" data-year="2011">Mazda</option> <option value="2" data-year="2015">Honda</option> <option value="3" data-year="2008">Mercedes</option> <option value="4" data-year="2005">Toyota</option> </select>$("#selectVehicle").change(function () { alert($(this).find(':selected').data("year"));});
Here is the working example: https://jsfiddle.net/ed5axgvk/1/