JS onclick function | Sololearn: Learn to code for FREE!


JS onclick function

Is it possible to use the same function for a onclick event, as I’m trying to change the colour of my website background. I apologise for the way it’s been written. https://code.sololearn.com/W38C34qFFlQ3/?ref=app

12/12/2019 8:40:04 AM

farhan bhatti

2 Answers

New Answer


Can you share the code in your original question Description? maybe it will be easier for others to understand what you mean if they can see your code. farhan bhatti The onclick and ondoubleclick event seems to work alright. Apart from images not loading, I can't seem to find an element having 'anime_head' ID, perhaps you meant 'anime'? the call to document.getElementById seem to fail updating that nonexistent element. Thank you for updating the question and including the code 👍


Ipang thanks for your feedback, ill try to play around with the code to try and get it to run 1 onclick event