jQuery multiply vars inside value [duplicate]

you forgot to concatinate the last string ”, so youre missing a “+”

 $('.customfield').val('<?php echo $userdata["id"] ?>,clicks,'+amount+','+cPrice+'');

though you dont need the last string bit cause its empty anyway so you can just

 $('.customfield').val('<?php echo $userdata["id"] ?>,clicks,'+amount+','+cPrice);

and you can concatinate as many variables as you want to

in the docs you can read that .val(value)

value is a String an Array of Strings or a function,
so in your case you are passing a string

http://api.jquery.com/val/

Leave a Comment