0
Replace table date with an image
How can I amend the below code to replace with image instead of text. As currently the text "<img src='images/image"+(getRand())+".png'/>" appeared instead of an image. $('#choices td').click(function (){ (this).replaceWith("<img src='images/image"+(getRand())+".png'/>"); });
3 Respuestas
+ 2
try this
`images/image${(getRand())}.png`
then get the image element, set the src to the string i shown above
+ 2
I tried to figure out the element of #choices id", i guess it should be a table. And getRand() should be getting a random from from image numbers.
Here is the demo of replaceWith function
https://code.sololearn.com/WmkkvZH7ucjf/?ref=app
0
SWL you should show us how does the element #choices presented on html with text.
And where is the getRand() function, what does the function do?