I am coding a fan site for a game called League of Legends and my users who would like to create character assemblies should click on the skill icons and give it a point. (maximum 30 points)
Expected Example: http://www.solomid.net/masteries.php
You basically have 30 points. When you click on a skill image, it adds a point to that skill.
Since I'm new to JS and jQuery, I would like to ask:
Currently, I can create a div and give it a warning onClick = ("I clicked."); "so he warns when someone clicks on a div. I need to update it a bit, let's say:
- The user clicks on the div (for example, let's say that the skill value is currently 0/4)
- 0 increases by 1, becomes 1/4.
- The user repeats this 3 times, gives the skills 4/4 points.
- This value should be sent to the PHP page, so it is saved in the form.
How can i do this? Could you give an example of how this works in jQuery?As you can see, when you click on skills, it generates an int value after the hash line.
For instance; # 033200000000000000300000000000000000000000000000000
The value of this line, [skill1_value] [skill2_value] [skill3_value] ... [skillLast_value]
So, if you see such a value,
30001 (other 0)
This means that the user clicked 3 times on the "first skill", did not click on the next 3 skills. Once clicked the fifth skill.
Instead of publishing every form value for PHP, I will publish the integer value of the hash string. The rest of the calculations will be done using PHP.
Version TL, DR
- Imagine a 3x div. (div1, div2, div3)
- Imagine that each div contains the value of the visible number on the screen. (val1, val2, val3)
- By default, all values ββare 0.
- If you click on div1, the value of val1 should be increased by 1. If you click on div2, the value of val2 should be increased by 1, etc.
- New values ββshould always be displayed in the HTML output. 6 When the user clicks βSaveβ, he must generate a line such as: (val1 + val2 + val3 ...) (for example, 716).
Any help is appreciated. I know this is a beginner, so links to articles will also be useful.
source share