PDA

View Full Version : Is there a unique identifier for a textbox?


pizzaguy
04-21-2003, 03:32 PM
When the user fires a event, either by mouse click or key press, is there a way to tell the control firing that event is a textbox. I am trying to write a generic function on document level to handle the event if it is fired by a textbox, but it did not seem to have a unique indentifier for a textbox: not the tagName "INPUT" which is shared by other form objects, and I cannot use id name or class since not all textboxes have a common pattern. Is there a "type" property for the tag "INPUT"? I have tried this but do not seem to work.

beetle
04-21-2003, 03:35 PM
if ( obj.tagName == 'INPUT' && obj.type == 'text' )

pizzaguy
04-21-2003, 03:41 PM
It works, thank beetle.

beetle
04-21-2003, 04:14 PM
Also, so you know, the DOM-Approved® property equivalent to tagName is nodeName

:thumbsup:

jkd
04-21-2003, 06:38 PM
Originally posted by beetle
Also, so you know, the DOM-Approved® property equivalent to tagName is nodeName

:thumbsup:
tagName is fine if nodeType == 7
http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-745549614