{"id":1374,"date":"2022-08-30T15:16:00","date_gmt":"2022-08-30T15:16:00","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/15\/need-to-remove-a-br-with-js-css-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:16:00","modified_gmt":"2022-08-30T15:16:00","slug":"need-to-remove-a-br-with-js-css-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/need-to-remove-a-br-with-js-css-collection-of-common-programming-errors\/","title":{"rendered":"Need to remove a &lt;br&gt; with JS\/CSS-Collection of common programming errors"},"content":{"rendered":"<p>Here is how you are going to fix this&#8230;<\/p>\n<p>Create a modified script out of the original script and remove the original.<\/p>\n<p><strong>Code<\/strong><\/p>\n<pre><code>\n    function fixScript() {\n        \/\/ Get all the scripts in the page\n        var scripts = document.getElementsByTagName( 'script' );\n\n        for(var i = 0; i &lt; scripts.length; i++) {\n            \/\/ Find the script we need\n            if(scripts[i].childNodes[0] != undefined) {\n                if(scripts[i].childNodes[0].textContent.indexOf(\"<br \/>\") !== -1) {\n                    \/\/ Get the code from the script\n                    newData = scripts[i].childNodes[0].textContent.replace(\"<br \/>\", \"\");\n\n                    \/\/ Remove the old script\n                    scripts[i].parentNode.removeChild(scripts[i]);\n\n                    \/\/ Create a new script with fixed data\n                    var s1 = document.createElement(\"script\");\n                    s1.type = \"text\/javascript\"; \n                    s1.textContent = newData;\n                    var s = document.getElementsByTagName(\"script\")[0];\n                    s.parentNode.insertBefore(s1, s);\n\n                    \/\/ Stop\n                    break;\n                }\n            }\n        }   \n    }\n\n<\/code><\/pre>\n<p><strong>Output<\/strong><\/p>\n<pre><code>\n    \/\/\n\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-15 09:07:02. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Here is how you are going to fix this&#8230; Create a modified script out of the original script and remove the original. Code function fixScript() { \/\/ Get all the scripts in the page var scripts = document.getElementsByTagName( &#8216;script&#8217; ); for(var i = 0; i &lt; scripts.length; i++) { \/\/ Find the script we need [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1374","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1374"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1374\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}