aaronfreed Posted March 26, 2021 Report Share Posted March 26, 2021 i have a flow of registration forms with an 'exit' url on each page, which allows the users to exit before the full registration is complete. before following the click URL, i want an 'are you sure' confirmation message to be displayed to the user. if 'yes' then the click URL would be loaded; if 'no' then nothing would happen. i have the following html/jquery code in the footer of forms that are part of the registration process: <a class="exits" href="https://c1dcs255.caspio.com/dp/0db19000a392125dc37d41b6a8ab">exit</a> <script type="text/javascript"> $('.exits').on('click', function () { return confirm('Are you sure? Your order will not be registered.'); }); </script> straightforward as this seems, i can't get it work. i never get a confirmation popup. Quote Link to comment Share on other sites More sharing options...
CoopperBackpack Posted March 29, 2021 Report Share Posted March 29, 2021 Hello @aaronfreed, I am afraid that I cannot help with jquery code. As for me, I usually add EventListeners to the Footer section like this: <script > document.addEventListener('DataPageReady', onClickHandler); function onClickHandler() { const exitLink = document.querySelector('.exits'); exitLink.addEventListener('click', confirmMessage); } function confirmMessage(event) { const conf = confirm('Are you sure? Your order will not be registered.'); if (conf == true) { window.location = "https://c1dcs255.caspio.com/dp/0db19000a392125dc37d41b6a8ab"; } } </script> You may check if this solution works as expected. Maybe someone will help with the jquery version. Quote Link to comment Share on other sites More sharing options...
TellMeWhy Posted April 5, 2021 Report Share Posted April 5, 2021 This is not working because Caspio does not have the jQuery library, you will have to include it in your header. You may find the CDN here https://www.w3schools.com/jquery/jquery_get_started.asp aaronfreed 1 Quote Link to comment Share on other sites More sharing options...
aaronfreed Posted April 6, 2021 Author Report Share Posted April 6, 2021 thank you, @TellMeWhy. that worked like a champ. and thank you, @CoopperBackpacki got the jquery version to work, but i like your / direct native approach and will likely use it elsewhere. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.