I have some dropdown list like this :
<select name="qty" class="mb10" onchange="test()" data-plan-type="offer" data-plan-id="7395" data-plan-day="2210009">
<option value="0">0 rooms</option>
<option value="1">1 rooms</option>
<option value="2">2 rooms</option>
<option value="3">3 rooms</option>
<option value="4">4 rooms</option>
</select>
And this is my function which called with onchange event :
function test()
{
var this_plan_type = $(this).data('plan-type');
var this_plan_id = $(this).data('plan-id');
var this_plan_day = $(this).data('plan-day');
alert(this_plan_type);
}
The problem is with onchange event I cannot call data attribute in my <select>. How could I call that data attribute inside function ?