I have the following markup:
<div class='header-vals' data-item-id='23'>
<input type='text' name='some-input' />
<input type='text' name='some-other-input' />
</div>
and would like ot access the data-item-id with something like this (but this doesn’t work):
$('.header-vals').on('keyup','input',function(){
var item_id=$(this).data('item-id');
});
Is there a way to make the reference of this to the outside so that I can get the data-item-id?
thx in advance
Do this way:-
Refer LIVE DEMO