Form itself

There is such a form, you need to make it so that when you click on the numbers on the right, they are added to the "Your shares" field, I wrote a script, but when we click on, let's say the number "5" in the field says "5", when you click another number, for example "34 "it overwrites that number" 5 "with" 34 ", and it is necessary that it be added, separated by commas, for example," 5.34 ". How to do this?

1 answer 1

What is the problem with the old val add more text?

var val = $('#elem').val(); var new_val = 34; $('#elem').val(val+','+new_val); 
  • You did not understand, there may be a maximum of 150 values, that is, I’m right on the numbers, and they are added to the field separated by commas. - pavlikmd
  • In my version, this will happen - Mr_Epic
  • in your version, as I understand it, you can choose only 2 numbers, and if a person wants to choose 15 or 100 - pavlikmd