$().ready(function() { $('#ex2').jqm({trigger: 'a.ex2trigger', modal:true}); var agreeToTos=getCookie("agreeToTos"); var showModalPopup = 'yes'; var pathname = window.location.pathname; // Returns path only if(agreeToTos != "yes" && showModalPopup != 'no' && pathname != "/legal.termsofservice.php") { $("a.ex2trigger").click(); } $(".pink-button").click(function(evt){ setCookie("agreeToTos", "yes", 365); $('#ex2').jqmHide(); evt.preventDefault(); }) }); function getCookie(cname) {//Function to get value of specified cookie var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i