0

How can I remove only the src not the whole image I tried something like this

$(this).parent().find('img').not(this).remove();

But it is not working it deletes the image and then when I try to upload again it does not upload because it can not find the image

2
  • 1
    Set the src attribute to an empty string. Commented Jan 22, 2018 at 10:44
  • 1
    What do you mean remove the src? Commented Jan 22, 2018 at 10:45

2 Answers 2

0

To remove the src attribute, set it to null

$(this).parent().find('img').not(this).attr(src, null);

Or you can use the jquery .removeAttr() mehtod:

$(this).parent().find('img').not(this).removeAttr(src);

More information here on .removeAttr()

Sign up to request clarification or add additional context in comments.

Comments

0
$(this).parent().find('img').not(this).attr("src","");

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.