How to do the same functionality but not with a dropdown, but with a radio?
There is a working code to implement the following functionality - changing the price of a product depending on its quantity.
Those. if you manually add / subtract quantity to the qty input or with controls + - then when the borderline values are reached, the real price value for the current quantity is substituted in the price field.
With a little refinement, I added the ability to select any of these boundary values from the dropdown list: i.e. if the user needs 100 or 200 units of goods at once, then you can either prescribe manually, or click with a plus - the longest - or - the fastest - select the desired value from the dropdown list. When you select such a value, the price changes and the quantity in the qty input field changes synchronously.
Naturally, manual choices do not disappear anywhere, i.e. if a person needs not 10 or 20 but 15, then he can always enter this amount manually.
Here's what happened. Now the implementation code of the dropdown is important, it is at the very bottom - in the third part of the code. But I cite the entire code in its entirety, otherwise it will not work.
Now I want to redo this code a little so that instead of a dropdown I would have a table with the choice of the desired value using radiobuttons.
Here's what I have at the moment (the upper code is all 1k1, we look only the lower one).
The table is drawn, the selected value of the radio is transferred to the qty input, but the price does not change.
Tell me what is wrong and how to make this code work.
simplified, threw out the excess, it worked.
Maybe even how to simplify it ..Aidan Sherman
To place the code, please use CodePen or similar tool. Thanks you!