I would like to know if it is possible to hide the button after the user fills out the popup maker form, popup maker generates a cookie and I would like not to show the button after the cookie is created
Hide after filling form
I tried to do something with code but I can't make it work
<script>
jQuery(document).ready(function() {
Cookies.get('pum-9663-list') {
jQuery(".buttonizer").hide();
});
});
</script>
This is the page that I am trying to make it work https://www.alexgimenez.es/test
- Edited
Hi neltous ,
Great question.
The code that you sent in the original post will only look for the cookie when you load in the page. This means that once you fill in your form, Buttonizer will not hide until the user refreshes the page.
To detect if the cookie has been set, you will need to use an interval that will keep looking for the cookie every couple of seconds.
I've managed to hide Buttonizer after filling in a form without relying on cookies by using the trigger that Popup Maker uses.
Copy and paste the script below into your site.
( This only works on Popup Maker forms. When using other forms like Gravity Forms, take a look at Popup Maker's documentation regarding those )
<script type="text/javascript">
jQuery(document).ready(function() {
// #pum-{POPUP-ID}
jQuery('#pum-9663')
// pumFormSuccess is triggered after form success
.on('pumFormSuccess', function () {
// hide Buttonizer
jQuery(".buttonizer").hide()
});
});
</script>
Please let me know if this works for you!
- Edited
Will it be possible to do that hidden when I generate a cookie or when it read a cookie?
- Edited
- Best Answerset by neltous
Sorry for the late reply.
Yes, it's possible to hide Buttonizer if the cookie exists.
To do that, we need to add a similar code like in your original post to check if the cookie exists after refreshing the page.
Copy and paste this script under the one I sent a couple of posts back:
<script type="text/javascript">
// This function runs after Buttonizer is ready
function buttonizerInitialized() {
// If the cookie exists. pum-{POPUP ID}
if(Cookies.get("pum-9663")) {
// Hide Buttonizer
jQuery(".buttonizer").hide()
}
}
</script>
This should now hide Buttonizer after refreshing the page.