Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

前端 未结 6 1565
星月不相逢
星月不相逢 2020-12-05 09:30

I\'m getting this error and it is originating from jquery framework. When i try to load a select list on document ready i get this error. I can\'t seem to find why i\'m gett

6条回答
  •  无人及你
    2020-12-05 09:41

    It causes the error when you access $(this).val() when it called by change event this points to the invoker i.e. CourseSelect so it is working and and will get the value of CourseSelect. but when you manually call it this points to document. so either you will have to pass the CourseSelect object or access directly like $("#CourseSelect").val() instead of $(this).val().

提交回复
热议问题