Skip to content

Instantly share code, notes, and snippets.

@kolbaba
Last active September 26, 2019 14:28
Show Gist options
  • Save kolbaba/578aa2db319023e5178c3856e622abed to your computer and use it in GitHub Desktop.
Save kolbaba/578aa2db319023e5178c3856e622abed to your computer and use it in GitHub Desktop.
PNT jQuery Tracking

PNT jQuery Tracking

Note: We are not using jQuery for tracking anymore due to it's incompatibility. Instead please reference the PNT & Form Tracking documentation.

Add PNT jQuery

$( "form" ).addClass( "pnt" );
jQuery( "form" ).addClass( "pnt" );
pntjQuery( "form" ).addClass( "pnt" );
document.getElementsByClassName('form')[0].classList.add('pnt');

jQuery Loop Version 1

<script>
jQuery(function(){
    (function loop() {
        setTimeout(function () {
            var f = jQuery('form');
            if (f[0]) {
                f.addClass('pnt');
                
            } else {
                loop();
            }
        }, 250);
    }());
});
</script>

jQuery Loop Version 2

<script>
$(function() {
    var loop = setInterval(function () {
            var $form = $('form')
        if ($form.length) {
            $form.addClass('pnt')
            clearInterval(loop)
        }
    }, 250);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment