Home javascript How to remove / reset src in IMG tag via JS?

How to remove / reset src in IMG tag via JS?

Author

Date

Category

How to reset or remove from tag img attribute src via JS?

on the theory that it removes:

serviceessite.innerhtml = "";

thought it was also working, but no:

servicesico.src = '';

That is, I have a function that adds the SRC tag from the massif:

let s_names = [
  {Site: 'img / logo.svg'},
  {Site: 'img / logo-2.svg'},
]

He simply adds it to the past src and the picture for the second time is not visible when entering, because in SRC Belebere, and therefore I want to somehow click on Delete button from src or src yourself from img .

I begin.


Answer 1, Authority 100%

You can try RemoveAttribute Try

servicesico.removeattribute ("src"); // If in Servicesico IMG object

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions