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++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -