So I have two pages, user-edit.php in the admin and a page for members to edit their own profiles. There is a group of section on both that has the same coding, the same css id's, the same classes, the same text etc etc everything.

But the same code will not work for them and I don't know why.

For the js code I have 'wp_enqueue_scripts' and 'admin_enqueue_scripts' in the child theme's functions.php and they link and find the correct pages respectively. The CSS references the id and the id is the same in both cases.

Is there any reason inbuilt into WordPress that I would have to do differently?

The code itself is quite simple.

`let deleteText = document.querySelector("label[for='fake-for-question']") let describeText = document.querySelector(".description")

console.log("Some text that does show up in the console when run") deleteText.textContent = "" describeText.textContent = "This is the new text I want here."`

The js error complains that the property is null. (The CSS just changes the visibility to hidden.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.