Why isn't my JS working (in wordpress)?
<p>What I'm trying to do is have a number count-up on my page that increases at a steady increment/interval. I created stylized images to represent each number 0-9 in the count-up, so I also need to replace each number with its respective image. The first Function in the code represents that task, and the second script is the actual count-up. I'm using wordpress so I've added the JS file and enqueued it in the header.php file.</p>

<p>Here's where I had my problem: I was able to get the count-up to work, but the <code>counterimages(input)</code> function doesn't want to work for me. It might be an issue with how I am trying to "call" on the function on the WordPress page.</p>

<p>If anyone could help me out I would be very grateful!</p>

<pre><code>function counterimages(input) {
var output = ""

for (var i = 0; i &lt; input.length; i++) {
    var chr = input.substring(i, i + 1)
    if (chr == '£') {
        output += '&lt;img border="0" src="img/pound.gif"&gt;';
    } else if (chr == '.') {
        output += '&lt;img border="0" src="img/dot.gif"&gt;';
    } else {
        output += '&lt;img border="0" src="http://eatiply3.staging.wpengine.com/wp-content/uploads/2013/05/'+(chr+1)+'.png"&gt;';
    }
return output;
}

var START_DATE = new Date("October 21, 2012 22:30:00"); // put in the starting date here
var INTERVAL = 1; // refresh interval in seconds
var INCREMENT = 769.2;  // increase per tick (1/0.0013 ~ 769)
var START_VALUE = 35000; // initial value when it's the start date
var count = 0;

jQuery(document).ready(function($) {
 var msInterval = INTERVAL * 1000;
 var now = new Date();
 count = parseInt((now - START_DATE)/msInterval) * INCREMENT + START_VALUE;
 $('#counter').html(count.toFixed(0));

 window.setInterval( function(){
    count += INCREMENT; 
    $('#counter').html(count.toFixed(0));
 }, msInterval);

});`
</code></pre>
