I have some JavaScript on my page which contains a variable.
The script is run on a click event.
I would like to have a form field that allows for a visitor to input a value for the variable before running the script.
I’ve been search around for a solution, but nothing I’ve found appears to be the answer.
Anyone have any tips for what I should be googling?
Cheers,
Brandon
swilliam
(scott williams)
17 July 2016 15:27
2
I’m not sure I’m following you correctly but basically you want to have a one field form that then runs a script (like you would run a validation script) onsubmit ? Similar to this?
` ,
The part of the script that needs the variable looks like this.
$(".myButton").click (function(){ $.post( "https://www.url.com", { "value1" : "FORM_VARIABLE"} ); });
I imaging having a form field who’s value will be populated as the value1