How do I do this?

javascript

#1

I am making a little project called “Potion Clicker” and I am wondering if there is a way to make it so
when I click on the potion (It’s an img tag) the 0 will become 1 and every time you click it goes +1 up?

Sorry I woke up really bad, so my grammar is not that good right now…


#2

this is possible, do you use vanilla js or a library like jquery? Using jquery would make things easier

you need to add a click event, get the value from the element, and increase it by one and update the DOM

what code do you have so far?


#3

Is it possible you could show me examples of the vanilla js and the jquery?

I have no code right now, I have tried multiple times but have failed so I removed those code so I could do new scripts.


#4

i can help with your existing code, but writing code from scratch is exactly a programmers job, which is a paid job. I think there is quit a difference there

you should decide if you want to use (vanilla) JS or jquery, once you have some code, i can push you in the right direction


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.