Getting started can't use $("attributeName")

2 views
Skip to first unread message

hanoah

unread,
Dec 16, 2009, 4:13:59 PM12/16/09
to Firebug
I am using firebug lite in IE 6. Firebug version 1.23,20090506

I am following a simple tutorial and am stuck at the first part. I
have a simple html page as follows;


<html>
<head>
<title>Firebug Testing</title>
<script language="javascript" type="text/javascript" src="C:/
rad75workspace/MPages/WebContent/script/common/firebug-lite.js"></
script>
</head>
<body>
Name : <input id="nameTextBox" class="normalText" type="text" />
</body>
</html>


When I type $("nameTextBox") on the command line I get this error
"Error: Object expected".

The is exactly what the tutorial is telling me to try.

If I try the same thing, using the same file iin Firefox with the full
Firebug add-on. It works fine.

Does Firebug-Lite not support this?

EugeneZ

unread,
Dec 21, 2009, 11:41:08 AM12/21/09
to Firebug
I've never used Firebug Lite, but I don't see any documentation that
says $(...) is functionality added by firebug lite. If you saw that
function being used in a tutorial, the author most likely assumed you
were using a javascript web framework like jQuery or MooTools. Most of
these libraries provide the $(...) function, typically as a shortcut
for document.getElementById(), which appears to be the way you're
using it.

Try this in the console instead:

document.getElementById("nameTextBox")

If you like the $() syntax, you may wish to also include jQuery or
MooTools in your page to provide it. Or simply add this to your page:

<script type="text/javascript">
window.$ = document.getElementById;
</script>

Mike Ratcliffe

unread,
Dec 21, 2009, 11:57:04 AM12/21/09
to Firebug
It probably comes from the fact that the $() method works in the
Firebug Console ... maybe it should also work in Lite.

hanoah

unread,
Dec 22, 2009, 2:48:25 PM12/22/09
to Firebug
Thanks for the reply, seems that the $(...) functionality just doesn't
work in Firebug Lite. The suggestions you gave were good ones and have
helped me to continue on.

Thanks!

Mike Ratcliffe

unread,
Dec 22, 2009, 3:55:07 PM12/22/09
to Firebug
I have logged an issue for you at:
http://code.google.com/p/fbug/issues/detail?id=2628
Reply all
Reply to author
Forward
0 new messages