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

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -