javascript - How to get type of a textarea -
as part of larger script have snippet of code:
if (form.elements[i].type === 'text') { // stuff } it works fine on input type=text not @ on textarea. have tried modify script this:
if (form.elements[i].type === 'text' && form.elements[i].type === 'textarea') { // stuff } still nil on textarea... ideas please?
that's because <textarea>s don't have type property. need check element name. form.elements[i].tagname === 'textarea'. (tagname returns in caps.)
edit: need utilize || (or) operator instead of && (and). element can't both @ same time!
javascript
No comments:
Post a Comment