javascript custom attribute returns undefined code example Example: custom attribute coming as undefined var text = $(this).data("overlay") alert(text);