In the end, I decided that this was not a problem that I especially needed to fix, but it bothered me that I did not understand why this was happening.
Basically, I have some checkboxes, and I want users to be able to select a certain number of them. I use the following code to achieve this effect.
$j( function () {
$j('input[type=checkbox].vote_item').click( function() {
var numLeft = (+$j('#vote_num').text());
console.log(numLeft);
if ( numLeft == 0 && this.checked ) {
alert('I\'m sorry, you have already voted for the number of items that you are allowed to vote for.');
return false;
} else {
if ( this.checked == true ) {
$j('#vote_num').html(numLeft-1);
} else {
$j('#vote_num').html(numLeft+1);
}
}
});
});
And when I tested it, I noticed that if I used:
$j('input[type=checkbox]').each( function () {
this.click()
});
Javascript reacted as I expected, however when used with:
$j('input[type=checkbox]').each( function () {
$j(this).click()
});
Actually the counter is an UP counter.
I understand that this is not the safest way to count the counters, but I have a server-side error check that prevents entering into the database a larger amount of the required amount, which is the reason that I decided that this is actually not required.
: $j , jQuery noConflict...