PDA

View Full Version : how can i get the name of an input type ?


frontline
03-19-2003, 10:46 AM
hello
im trying to get html tag by name with
elm.tagName but when i try to query input=checkbox im getting only "input" as result and not "checkbox"
why?
how can i query html tag and get checkbox as result ( of course if its html checkbox)
tnx

joeframbach
03-19-2003, 12:45 PM
try changing the query to type=checkbox

Roelf
03-19-2003, 03:16 PM
<html>
<head>
<title>test</title>
<script type="text/javascript" language="JavaScript">
function alertype () {
alert (event.srcElement.getAttribute("type"))
}
</script>
</head>
<body>
<input type="checkbox" onclick="alertype()">
</body>
</html>

cheesebagpipe
03-20-2003, 12:25 AM
You're getting 'INPUT' because, well, that's the tag name.

if (typeof elm.type != 'undefined') alert(elm.type);