I am trying to write a rather simple “select all” feature, but I am getting errors with my javascript. The code is rather straight forward, so I’ll just post it:
(function() {
$(function() {
var all_check_box;
all_check_box = '#tournament_league_127';
return $(all_check_box).change(function() {
return $('.leagueCheckBox').each(function() {
return this.prop("checked", true);
});
});
});
}).call(this);
This code was generated by the following CoffeeScript:
$ ->
all_check_box = '#tournament_league_127'
$(all_check_box).change ->
$('.leagueCheckBox').each ->
this.prop("checked", true)
However, when I click #tournament_league_127, I get the following error: this.prop is not a function. I’m not really sure what I’m doing wrong. Any help would be appreciated.
It should be
$(this).prop ...(assuming jQuery 1.6+, before that.propdid not exist).