inferno-prime 0 Posted January 2 Share Posted January 2 Did some searching on google could not find anything so far. I have a wordpress theme and I would like to change the name of the script id if that won't be to hard. Quote Link to post Share on other sites
NotSunfighter 6 Posted January 2 Share Posted January 2 What do you mean by "script id"? Never heard of that even in wordpress. Quote Link to post Share on other sites
inferno-prime 0 Posted January 3 Author Share Posted January 3 Sorry I meant the javascript. When viewing in the inspect element in firefox it has a name for each script in the head section. Quote Link to post Share on other sites
requinix 977 Posted January 3 Share Posted January 3 Script IDs never matter. Why do you want to change it? Quote Link to post Share on other sites
inferno-prime 0 Posted January 3 Author Share Posted January 3 I would like to learn how. Is that alright? Quote Link to post Share on other sites
requinix 977 Posted January 3 Share Posted January 3 This isn't even a thing you "learn how" to do. It's like saying you want to learn how to unscrew a bottle lid. The ID comes from a place. Find where that place is, change it for fun, and then move on with your life. Quote Link to post Share on other sites
inferno-prime 0 Posted January 3 Author Share Posted January 3 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 ? Quote Link to post Share on other sites
requinix 977 Posted January 4 Share Posted January 4 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. Quote Link to post Share on other sites
inferno-prime 0 Posted January 4 Author Share Posted January 4 according to an article it does have a handle that you choose to set. Quote Link to post Share on other sites
ElijahTivey 0 Posted February 23 Share Posted February 23 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? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.