Calling A JavaScript Function On Or Before Form Submission?
-
Hi. This is a rather unique case but I’m developing a sort of bookmark feature for my site. Chapter Bookmark is a CPT for which I have a create post ACFE form.
I’ve found code that allows me to insert highlighted text into my ACF textarea field on the form on button click using a JS function. This is the code I’m using:
And you can see it in action in a short video here:
But ideally I’d like to do this action without a button click and perhaps call the function after finishing highlighting the text. Is there some solution to getting this functionality?
For example, calling the function and inserting the text on form submission or perhaps before submission since it may not be inserted early enough? Failing this, even having a button within the form itself that calls the function and inserts the currently selected text.
I know how to call PHP functions on form submission but I’m not sure if/how it can be done with JS.
Appreciate any help you can provide. Thanks.
The topic ‘Calling A JavaScript Function On Or Before Form Submission?’ is closed to new replies.