My html is like
...
An attribute value must be inside ' '
Try something like this:
$.each("div[data-role='page']", function (){ console.log($(this).attr('id')); });