is there any elegant way to get element type by name?
I can expect rendered form contains dropdowns, inputs, tables, divs with name like “answer[x]” where x represent some number.
I need element type to know how to handle it.
I can try to get object with :
$('td[name=answer\\[1\\]]')
$('div[name=answer\\[1\\]]')
$('input[name=answer\\[1\\]]')
and when $('input[name=answer\\[x\\]]').length > 0 then “great! its input!”.
It just doesn’t look like elegant way…
For me
$("[name='answer[" + x + "]'")[0].tagNameis quite elegant 🙂