inferno-prime Posted January 2, 2021 Share Posted January 2, 2021 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 comment https://forums.phpfreaks.com/topic/311966-how-to-change-script-id/ Share on other sites More sharing options...
NotSunfighter Posted January 2, 2021 Share Posted January 2, 2021 What do you mean by "script id"? Never heard of that even in wordpress. Quote Link to comment https://forums.phpfreaks.com/topic/311966-how-to-change-script-id/#findComment-1583620 Share on other sites More sharing options...
inferno-prime Posted January 3, 2021 Author Share Posted January 3, 2021 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 comment https://forums.phpfreaks.com/topic/311966-how-to-change-script-id/#findComment-1583622 Share on other sites More sharing options...
requinix Posted January 3, 2021 Share Posted January 3, 2021 Script IDs never matter. Why do you want to change it? Quote Link to comment https://forums.phpfreaks.com/topic/311966-how-to-change-script-id/#findComment-1583623 Share on other sites More sharing options...
inferno-prime Posted January 3, 2021 Author Share Posted January 3, 2021 I would like to learn how. Is that alright? Quote Link to comment https://forums.phpfreaks.com/topic/311966-how-to-change-script-id/#findComment-1583625 Share on other sites More sharing options...
requinix Posted January 3, 2021 Share Posted January 3, 2021 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 comment https://forums.phpfreaks.com/topic/311966-how-to-change-script-id/#findComment-1583629 Share on other sites More sharing options...
inferno-prime Posted January 3, 2021 Author Share Posted January 3, 2021 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 comment https://forums.phpfreaks.com/topic/311966-how-to-change-script-id/#findComment-1583647 Share on other sites More sharing options...
requinix Posted January 4, 2021 Share Posted January 4, 2021 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 comment https://forums.phpfreaks.com/topic/311966-how-to-change-script-id/#findComment-1583651 Share on other sites More sharing options...
inferno-prime Posted January 4, 2021 Author Share Posted January 4, 2021 according to an article it does have a handle that you choose to set. Quote Link to comment https://forums.phpfreaks.com/topic/311966-how-to-change-script-id/#findComment-1583652 Share on other sites More sharing options...
ElijahTivey Posted February 23, 2021 Share Posted February 23, 2021 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 comment https://forums.phpfreaks.com/topic/311966-how-to-change-script-id/#findComment-1584720 Share on other sites More sharing options...
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.