G
G
Good Samaritan2018-02-19 13:30:48
JavaScript
Good Samaritan, 2018-02-19 13:30:48

How to assign an img tag to a variable?

I am creating a variable. I am
var edit = document.createElement('a');
trying to add an img tag to the content as follows

edit.textContent = '<img src="edit.png" width="20px">';

Does not work.
How would it be more correct?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Pugachev, 2018-02-19
@djamali

Jamali Meslaurov ,
innerHTML

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question