<div id="123" data-img-flag="1"><image src="abc.png"></div><div id="432" data-img-flag="0"><image src="abc.png"></div><script>alert($(popImgId).data('img-flag'));// when we use data function to get the data attribute value wll get all time value loaded at the time of DOM loadedalert($(popImgId).attr('data-img-flag'));// value will get lates. If we change/update value using jquery will get updated value </script>
//get the result as array<option value="<?php echo $value['id']; ?>" data-count="5"></option>var data =$('.myclass').map(function(){return$(this).data('optionid');}).get();