Streaming live at 10am (PST)

Using onclick and onfocusout in form fields

Hi,

I’m trying to make a product form that calculates the price depending upon what options there are selected in the form. I got the JS working but need to add onclick and onfocusout triggers to form elements. Both are reserved attributes. Is there any way of doing this without having to put the form elements into an html embed?

1 Like

Use onclick and onfocusout vanilla js (or Jquery) events (using the addEventListener() method).

This is ± the outline (select element X and run Function Y on Event):
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onfocusout_dom

Jquery option:
https://api.jquery.com/focusout/

Add read-only link for specific example.

1 Like