javascript - Uncaught TypeError: elements[i].attr is not a function -


this code:

function () {     var container = document.getelementbyid('data-table');     var elements = container.getelementsbytagname("input");     (i = 0; < elements.length; i++) {         elements[i].on("ifchanged", handle_company_state(elements[i].attr('id')));      } }  function handle_company_state(element_id) {     //.... } 

when i'm trying run i' getting error:

uncaught typeerror: elements[i].attr not function

why?

i think looking like:

function () {     var elements = $("#data-table input");     (i = 0; < elements.length; i++) {         $(elements[i]).on("ifchanged", handle_company_state($(elements[i]).attr('id')));     } }  function handle_company_state(element_id) {     //.... } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -