First of all, I have read Can't append <script> element, After reading it, and utilizing what it said, I have reached a DIFFERENT problem: Yes, it showed me how to insert a script tag BUT when it does it "erase" the rest of the page:
I want to add the counter timer script, using jQuery. right after the id="counter" pargraph and by that insert a "counter" at that very spot: so instead of this code:
<body>
<p> beginning of site</p>
<table id="timer_table">
<tbody>
<tr>
<td>
<p id="counter" style="color: red;"> Here's the counter: </p>
</td>
</tr>
</tbody>
</table>
<p> rest of site...</p>
</body>
i'll get this code:
<body>
<p> beginning of site</p>
<table id="timer_table">
<tbody>
<tr>
<td>
<p id="counter" style="color: red;"> Here's the counter: </p>
<script>
var myCountdown1 = new Countdown({time:316});
</script>
</td>
</tr>
</tbody>
</table>
<p> rest of site...</p>
</body>
And where the script was added a new countdown will be shown. I do it by using the firebug console, I'm running this: (AS WRITTEN IN Can't append <script> element, tough, it STILL does NOT work well)
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "js_folder/js1.js";
$('#counter').after(script);
js1.js is simplly:
var myCountdown1 = new Countdown({time:316});
It doesn't work well. instead of getting this outcome: http://bit.ly/19Ve9oM I get this one: http://postimg.org/image/np8y4spbx/
And when i try to check the page source I get nothing.
To sum it up: How to use jquery for inserting the coundown right after the id="counter" paragraph? and that it would work as if the original html have had this line already written in it.
Also, I don't have access to the page's html source. If I had I would add it myself and it would work well, just as shown in the first pic link. Therefore I'm forced to use Jquery.
You can try yourself here (use the 2nd link for trying):
This is what i want: http://jsfiddle.net/JxLwM/
But doing it with jquery: http://jsfiddle.net/F5rwK/5/
Note, in 2nd link, try putting
var myCountdown1 = new Countdown({time:316});
in ss1, and see what happens. Thank you.