Jump to content

How to change script id


inferno-prime
 Share

Recommended Posts

Went to the functions file to change the wp_enqueue_script ('name' to something else now I have the new renamed script plus the previous one showing. I did some more research concerning this is the functions file the only place you use the : wp_enqueue_script/styles command for inserting script or styles for wordpress ?

Link to comment
Share on other sites

2 hours ago, inferno-prime said:

is the functions file the only place you use the : wp_enqueue_script/styles command for inserting script or styles for wordpress ?

More or less. When in doubt, check the documentation, and in the case of WordPress, any related hooks documentation.

Note that wp_enqueue_script does not say anything about a script ID.

Link to comment
Share on other sites

  • 1 month later...

This seems to work for me:

<html> <head><style> #monkey {color:blue} #ape {color:purple} </style></head> <body> <span id="monkey" onclick="changeid()"> fruit </span> <script> function changeid () { var e = document.getElementById("monkey"); e.id = "ape"; } </script> </body> </html>


The expected behaviour-changing the colour of the word "fruit".

Perhaps your document was not fully loaded when you called the procedure?

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.