javascript - Uncaught TypeError: Cannot read property 'change' of undefined -
what reason behind error?
is change
property deprecated in latest jquery version 2.1.1?
i'm working on ajax-chosen library function looks mentioned below:
$(document).ready(function () { $("#jaccomplete").ajaxchosen({ type: 'get', url: '/movies/getmoviesstartswith', datatype: 'json' }, function (data) { var terms = {}; $.each(data, function (i, val) { terms[i] = val; }); homecoming terms; }).change(function () { //you can see ids in console off items in autocomplete , deal them console.log($("#jaccomplete").val()); }); });
this found link : https://rvieiraweb.wordpress.com/2013/04/20/jquery-ajax-chosen-simple-demo-tutorial/
has faced same issue?
seems ajaxchosen() don't homecoming same object. seek attach event handler straight jquery object
$(document).ready(function () { $("#jaccomplete").ajaxchosen({ type: 'get', url: '/movies/getmoviesstartswith', datatype: 'json' }, function (data) { var terms = {}; $.each(data, function (i, val) { terms[i] = val; }); homecoming terms; }); $("#jaccomplete").change(function () { //you can see ids in console off items in autocomplete , deal them console.log($("#jaccomplete").val()); }); });
javascript jquery ajax jquery-chosen
No comments:
Post a Comment