admin管理员组文章数量:1315976
Hello friends i have this <script type="text/javascript" src=".php/tho_lionlaw_com_v2"></script>
form link in many wordpress pages, i would like to either replace the link with custom link or to be able to replace "src" attr to something else to stop it from loading
please note: that i already have tried this using script_loader_tag, but it replaces all attrs instead of that specific link from pages
thanks to all in advance
Hello friends i have this <script type="text/javascript" src="https://thompsonlaw.formstack/forms/js.php/tho_lionlaw_com_v2"></script>
form link in many wordpress pages, i would like to either replace the link with custom link or to be able to replace "src" attr to something else to stop it from loading
please note: that i already have tried this using script_loader_tag, but it replaces all attrs instead of that specific link from pages
thanks to all in advance
Share Improve this question edited Nov 14, 2020 at 14:03 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Nov 14, 2020 at 14:01 AsadAsad 1 6- i have more than 70+ pages having that link and its not easy to edit all pages to remove it so i am looking for a easy way around – Asad Commented Nov 14, 2020 at 14:03
- How is this being added to the pages? Is it in the post content? Via the enqueue script system? A part of the theme templates? – Tom J Nowell ♦ Commented Nov 14, 2020 at 14:42
- @TomJNowell its in page content in raw html avada theme is used – Asad Commented Nov 14, 2020 at 14:48
- I see, then this isn't something a code change can help you with, what you need is a search replace tool – Tom J Nowell ♦ Commented Nov 14, 2020 at 14:50
- @TomJNowell Preg_replace? or str ? – Asad Commented Nov 14, 2020 at 14:52
1 Answer
Reset to default 0Much like all programming, there are many ways to go about solving this. One way is using an id tag id = "script_lionlaw" (or name is whatever you want) within the script.
<script type="text/javascript" src="https://thompsonlaw.formstack/forms/js.php/tho_lionlaw_com_v2" id = "script_lionlaw"></script>
You could then use jquery (or some other means) to grab the tag and then replace it with whatever you want.
本文标签: javascriptReplace script attr or link
版权声明:本文标题:javascript - Replace script attr or link 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741995069a2409876.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论