Moving Javascript from inline to an external file
-
What up yall!
got a javascript question for all you smart people w/ sexy brains.
I am trying to move a bit of JS from inline (i have it inserted into a wordpress post) to an existing external file that I call in.
However– my code must require some kind of formatting changes or something- because it no longer works when I put it in the external file (the rest of the existing JS in that external file continues to work fine– however)
Anyone got ideas on what I need to change?
Here is my JS (this works inline):
<script type=”text/javascript”>// <![CDATA[
document.getElementById(‘FBsharer’).onclick = function () {
var url = ‘https://www.facebook.com/sharer/sharer.php?u=’;
url += encodeURIComponent(location.href);
window.open(url, ‘fbshare’, ‘width=640,height=320’);
};
// ]]></script>
- The topic ‘Moving Javascript from inline to an external file’ is closed to new replies.