When deactivated, all my Javascript stops firing
-
Hi,
I have BetterLinks installed in a new site that was created by migrating a copy of an existing site.
In the new site, I am not using BetterLinks. So I deactivated it and then all my javascript code stopped working.
For example, something as simple as the below is not working when BetterLinks is deactivated but it works OK when its activated.
This simply takes the entry of a text field and populates another field.When BetterLinks is active, I get the ALERT of 1 and ALERT of 2 as the page loads.
When I deactivate it, I get no ALERT messages.Doesn’t that seem weird? Any ideas?
I have since removed the ALERT messages so you won’t see them. But I deleted BetterLinks and the JS would not work. I reinstalled it and now it works. So why do I need BetterLinks for JS to work?Thank you
jQuery(document).ready(function($) {
alert(1);
// Function to update text field when dropdown is changed
function updateTextField(selectField, textField) {
alert(2);
selectField.on('change', function() {
textField.val($(this).val());
});
}
// Update location text field when location dropdown changes
updateTextField(
$('.wpcf7-form [name="location-select"]'),
$('.wpcf7-form [name="location-typed"]')
);
// Update work text field when work dropdown changes
updateTextField(
$('.wpcf7-form [name="work-select"]'),
$('.wpcf7-form [name="work-typed"]')
);
});The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.