$('input[type=checkbox]').change(function()
<p>Currently Im have the following script which checks to see if a checkbox value has changed but its not working when I try to use it!</p>

<pre><code>&lt;script&gt;
    $('input[type=checkbox]').change(function () {
        if ($(this).is(':checked')) {
            if ($(this).prev().attr('checked') &amp;&amp; $(this).val() != $(this).prev().val()) {
                alert("previous checkbox has same value");
            }
        }
    });​
 &lt;/script&gt;

 &lt;input name="" type="checkbox" value="here"/&gt;(if this was checked)
 &lt;input name="" type="checkbox" value="here"/&gt;(then this)
 &lt;input name="" type="checkbox" value="there"/&gt;(would not allow prompt alert) 
 &lt;input name="" type="checkbox" value="here"/&gt;(would allow)​
</code></pre>

<p>you can see it working here yet it does not work when i try to use it 
<a href="http://jsfiddle.net/rajaadil/LgxPn/7" rel="nofollow">http://jsfiddle.net/rajaadil/LgxPn/7</a></p>

<p>The idea is to alert when a checked checkbox value is different from the previously checked checkbox value! </p>

<p>Currently my checkbox look like</p>

<pre><code>&lt;input type="checkbox" name="checkbox[]" onClick="getVal();setChecks(this)" value="`key`=&lt;?php echo $rspatient['key']?&gt;" class="chk" id="chk&lt;?php echo $a++?&gt;"/&gt;
</code></pre>

<p>I thought the function <code>('input[type=checkbox]').change(function()</code> would get these but im wrong somewhere? </p>
