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:
Checkbox: <input class="category_select" title="3" name="subject_ids[]" onchange="check(11,this)" type="checkbox" value="6"/>
<input class="category_select" title="9" name="subject_ids[]" onchange="check(11,this)" type="checkbox" value="7"/>
<input class="category_select" title="6" name="subject_ids[]" onchange="check(11,this)" type="checkbox" value="8"/>
and the Jquery as follows
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.js">
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 > val){
$(that).removeAttr('checked');
alert('Total is greater than val !');
}else{
alert('Total is less than or equal to val !');
}
}
</script>
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