I want to add the counter timer script, using jQuery. right after the id="counter" pargraph 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>
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: Which jquery commnad do should i use to insert the
<script>
var myCountdown1 = new Countdown({time:316});
</script>
right after the id="counter" paragraph? and that it would work as if the original html had this line already written in it
Thank you