JavaScript execution works on Chrome and not WordPress

29
April 07, 2021, at 03:20 AM

I am running this code in Chrome console dev tools and it works:

const params = new URLSearchParams(window.location.search);
if (window.location.href.indexOf("Phone") != -1) {
  $('.test111232 a').attr('href', 'tel:1 ' + params.get('Phone'));
}
if (window.location.href.indexOf("state") != -1) {
  $('.test111232234 a').attr('href', 'https://www.example.com/ddd?state=' + params.get('state'));
}

However, when I save the page on WordPress with the Elementor HTML widget, it only changes the first number on the page.

Any ideas?

READ ALSO
Rows until a number reaches zero [Python]

Rows until a number reaches zero [Python]

I've been trying to find a solution to this problem for days, to no availOur warehouse asked for a way to calculate how many days it takes to process the incoming items, according to our forecast

60
My notification is sent only when I start the app on some devices

My notification is sent only when I start the app on some devices

I have developed a notification that is sent every time a BroadcastReceiver is woken up by an AlarmMaganerWhen the receiver shows the notification it also takes care of activating the next notification

50