...

View Full Version : need help with Microsoft JScript runtime error: '$' is undefined



hal9000
12-30-2011, 06:46 AM
I get "Microsoft JScript runtime error: '$' is undefined" with the javascript below. How should I troubleshoot this?

<script type="text/javascript" language="javascript">
function ShowPopup() {
$('#mask').show();
$('#<%=pnlpopup.ClientID %>').show();
}
function HidePopup() {
$('#mask').hide();
$('#<%=pnlpopup.ClientID %>').hide();
}
$(".btnClose").live('click', function () {
HidePopup();
});
</script>

Old Pedant
12-30-2011, 08:13 AM
That means you haven't loaded the jQuery library.

You should have a line that looks like

<script src="...some...url...that...ends...with....jquery.js"></script>

in your page.

$ is simply a variable name (yes, JS variables can use $ and can start with $) that jQuery [and a few other libraries, but the odds or 50 to 1 it's jQuery] uses as its universal "find anything anwhere" function name.

For example, $("#mask") means essentially the same thing as document.getElementById("mask")



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum