To make AI Chatbot appears on button click on Squarespace, you can follow these.
#1. First you need to install an AI Chatbot to your site. Here I use a free chatbot here.
#2. Edit Button > Enter this URL: #chatbot Make sure “Open in New Tab” is disabled
#3. Use this code to Code Injection > Footer
If code doesn’t work, you can comment below, message or send me an email.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('[href="#chatbot"]').on("click", function(event){
event.preventDefault();
let checkExist = setInterval(function() {
let chatbot = $('div[class*="eapps-ai-chatbot"] button');
if (chatbot.length) {
chatbot[0].click();
clearInterval(checkExist);
}
}, 100);
setTimeout(function() {
clearInterval(checkExist);
}, 5000);
});
});
</script>
#4. Done
When users click button >> AI Chatbot will open.