I can get my text to change using <button onclick="displayNewtext()">
but I cannot get a <img src="image.jpg" onclick="displayNewtext()">
to do it. Whats the correct code to use to make a click on an image trigger an onclick which runs a function that replaces text in the DOM?
Can you show a consolidated example showing this behavior? It sounds that a <button>
has text but an <img>
does not, so no text can update. Just a guess though. We need to see your code .
1 Like
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.