Reputation: 2053
Everytime I try to run the following code I get a:
.call is not a function
I can't figure out what is going on as this is a pretty straightforward piece of code. I must be missing something really obvious here. Thanks for the help. If possible please try to include code samples still learning here.
;(function($){
$.fn.call = function() {
var CLICK = 'click';
function ClickCall(event) {
var $call = $(event.target).closest('.call-survey');
if ($call.find('#yes').is(':checked')) {
$call.find('.call-survey fieldset').hide();
} else {
$call.find('div.call-survey-no').show();
$call.find('#yes').addClass('left');
}
}
return this.each(function() {
var $call = $(this);
$call.on(CLICK, '#chatForm', ClickCall);
});
};
})(jQuery);
$(document).ready(function () { $('.call-survey').call(); });
Upvotes: 0
Views: 465
Reputation: 190942
call
is a reserved name in JavaScript. It has to do with call
and apply
with functions.
I suggest changing it.
Upvotes: 1