Rich-text Reply

How can I edit onclick funtions on input fields for the variations ?

suvdeep 12-22-15

How can I edit onclick funtions on input fields for the variations ?

The objective is to change the behaviour/code of the onclick function on a submit button.

Level 1

Re: How can I edit onclick funtions on input fields for the variations ?

Hi there, thanks for your question!

 

What you can do is define a new function, and then change the attribute of the input fields to point to this new function instead of the old function, e.g. using this template:

 

$("#id").attr("onclick","new_function_name()");

 

You'll of course have to change the #id to point to the right element, and the new_function_name to the name of the new function. You can also add the code here directly instead of pointing to a function with the new code.

 

You can then use the code editor in the Optimizely experiment editor to add your code.

 

For some examples, please check these pages:

I hope this helps!

Nils