title: Uncaught ReferenceError: check is not defined
body: <p>Please help me out with this, jquery is working well in w3schools but in my rails 2 app its getting error like check not defined 
  Here is my html code:</p>
  
  <pre><code>Checkbox: &lt;input class="category_select" title="3" name="subject_ids[]" onchange="check(11,this)" type="checkbox" value="6"/&gt;
  
  &lt;input class="category_select" title="9" name="subject_ids[]" onchange="check(11,this)" type="checkbox" value="7"/&gt;
  
  &lt;input class="category_select" title="6" name="subject_ids[]" onchange="check(11,this)" type="checkbox" value="8"/&gt;
  </code></pre>
  
  <p>and the Jquery as follows</p>
  
  <pre><code>&lt;script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.js"&gt;
    function check(val,that) {
      var total=parseInt(0,10);
      $('.category_select').each(function(){
        if($(this).is(':checked')==true)
          total=total+parseInt($(this).attr('title'),10);
      });
      if (total &gt; val){
        $(that).removeAttr('checked');
        alert('Total is greater than val !');
  
      }else{
        alert('Total is less than or equal to val !');
      }
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>The above code works well , but when i insert it into my rails app its getting error , I dont know where I am going wrong.
  Any help is valuable</p>