js久々に触ったらundefined is not a function出た件
js久々に触ったらundefined is not a function出た
久々にjsやったら初歩で
undefined is not a function
って出て何もできなかった。
コードは以下。
$(function() { $('#area_button').changeArea(); }); $.fn.changeArea() = function() { $(this).on('click', function(){ console.log('aaa'); }); };
3分くらい悩んだけど、
$.fn.changeArea()
の()のところ要らなかった笑