prototypejs / prototype

Prototype JavaScript framework
http://prototypejs.org/
Other
3.53k stars 639 forks source link

Function tagName not on JQuery object causing "Cannot read property 'toLowerCase' of undefined" #334

Open DarkSnowy opened 6 years ago

DarkSnowy commented 6 years ago

Form.Element function getValue is throwing "VM43674 prototype.js:6476 Uncaught TypeError: Cannot read property 'toLowerCase' of undefined at getValue (VM43674 prototype.js:6476) at Object.insert (VM43675 insertLink.js:11) at InsertLink (selectLink.aspx:44) at :1:2"

Prototype.js build version 1.7.3

This is due to wrapping the element in a JQuery object and then trying to directly access a property of the element. Removing the JQuery wrapper fixed it for me but you may want to use element.prop("tagName").toLowerCase();. If you take the src in that direction then be wary that many of the functions the element are passed into will not expect a JQuery object and will also throw errors.