0

I try to read an src of image from here :-

<div class="featured_preview">
<img src="ggat/wp-content/uploads/2015/03/11-192x236.jpg" width="300">
</div>

By this code :-

jQuery(document).ready(function() {
    jQuery(".open-popup-link").click(function () {
        alert(jQuery(".featured_preview img").attr("src"‏););
});
});

Why show me this error :-

Uncaught SyntaxError: Unexpected token ILLEGAL

1 Answers1

0

Change this:

alert(jQuery(".featured_preview img").attr("src"‏);); // note the extra semi colon

By:

alert(jQuery(".featured_preview img").attr("src"‏));
D4V1D
  • 5,805
  • 3
  • 30
  • 65
  • As per @user3433831 stated in the comment, you have weird character in your code. Try deleting and rewriting the entire line. Works here: https://jsfiddle.net/dxxjk6sh/1/ – D4V1D Mar 28 '15 at 13:11