Script instead of button
// Wait for the Popup content to load
document.addEventListener('DOMContentLoaded', function() {
// 1. Get the URL of the page that submitted the form
const currentUrl = new URL(window.location.href);
// 2. Elementor passes submitted field data as URL parameters
// Find the parameter for your field (e.g., ?form_field_website_url=...)
// The field name is typically 'form_field_' + the Field ID
const submittedParam = currentUrl.searchParams.get('form_field_website_url');
if (submittedParam) {
// Decode the URL (removes %2F, %3A, etc.)
let submittedUrl = decodeURIComponent(submittedParam);
// Clean and standardize the URL for a clean 'site:domain.com' search
submittedUrl = submittedUrl
.replace(/^https?:\/\//, '') // Remove http:// or https://
.replace(/\/$/, ''); // Remove trailing slash
// 3. Construct the final Google Search URL (using URL-encoding for the colon)
const googleSearchUrl = `https://www.google.com/search?q=site%3A${submittedUrl}`;
// 4. Open the new tab and close the popup
window.open(googleSearchUrl, '_blank');
// 5. Close the Elementor popup after a brief delay
setTimeout(function() {
// Find the close button or trigger the close action if available (often requires Elementor's JS API)
// A simple DOM method is to click the 'close' icon if it exists:
const closeButton = document.querySelector('.dialog-close-button');
if (closeButton) {
closeButton.click();
}
}, 500); // 500ms delay to ensure the new window opens first
} else {
// Fallback message if the URL parameter isn't found
document.body.innerHTML = '