Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16090

load default image initially till the actual image is pushed through jquery

$
0
0

We have a image element in our html page and the src for that is being pushed though a jquery code (as given below):

>! index.html<img class="userImageDisplay" src="" alt="my profile image" />
>! index.js   var photoUrl = response.Photo;   $(".userImageDisplay").attr('src', photoUrl);

As the page loads, it shows the alternate text for fraction of a second till the src is updated.

I want to show an alternate image instead of the alternate text till the page loads.

Tried setting default value first and then resetting the response photo value but does not work.

$(".userImageDisplay").attr('src', "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_1280.png");var photoUrl = response.Photo;$(".userImageDisplay").attr('src', photoUrl);

Viewing all articles
Browse latest Browse all 16090

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>