Reputation: 37
out.println("<button type='button' class='button' onClick='addProgressGoal(" + g.getGoalProgress() + g.getGoalID() + g.getTargetValue() + ")'>Add Progress</button>");
How can I pass three seperate values in the addProgressGoal as just using + is obviously just sending across one value of g.getGoalProgress(), g.getGoalID() and g.getTargetValue() added together.
Here is my function:
function addProgressGoal(progress, id, target) {
For some reason I just cannot seem to send all three across in valid code
Upvotes: 0
Views: 1686
Reputation: 41
just put single apostrophe before and after the parameter value in the calling function example: onclick="addProgressGoal('abc','def');"
Upvotes: 0
Reputation: 644
Is that what you want ?
out.println("<button type='button' class='button' onClick='addProgressGoal(" + g.getGoalProgress() +", "+ g.getGoalID() +", "+ g.getTargetValue() + ")'>Add Progress</button>");
Commas between parameters ?
Upvotes: 1