dude
dude

Reputation: 4982

Add a full photo path to a img src using jquery

 <img id="lotImgtemp" src="" height="148px" width="200px" border="0">
    var photonames=$("#loyaltymemPhoto").val();     //1.jpg         
    $("#lotImgtemp").attr("src","localhost/sumerdia/uploaded_photos/'+ photonames +'");

How to add the value to img src ?

output i get the same "localhost/sumerdia/uploaded_photos/'+ photonames +'"

output i need is "localhost/sumerdia/uploaded_photos/1.jpg"

Upvotes: 0

Views: 132

Answers (1)

user1432124
user1432124

Reputation:

Instead of

$("#lotImgtemp").attr("src","localhost/sumerdia/uploaded_photos/'+ photonames +'");

try

$("#lotImgtemp").attr("src","localhost/sumerdia/uploaded_photos/"+ photonames);

Upvotes: 2

Related Questions