Wrox Programmer Forums
|
BOOK: Beginning JavaScript and CSS Development with jQuery
This is the forum to discuss the Wrox book Beginning JavaScript and CSS Development with jQuery by Richard York; ISBN: 9780470227794
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript and CSS Development with jQuery section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2009, 09:43 AM
Registered User
 
Join Date: Dec 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default $ undefined error

Hi, Richard,

I created a ASP.NET project and then followed your book "Try it out" for example 1-1 but got an error in page 6, step 3, said that $ was undefined.

if ($) {
$(document).ready(
....

Can you help me to fix it?
 
Old December 9th, 2009, 09:46 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Have you included jQuery in your script tag at the top of the page? Are you sure jQuery is getting loaded (i.e. is the path correct)?

What type of page did you create? aspx or html? If you view source are there other scripts being loaded? What version of Visual Studio are you using?
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old December 9th, 2009, 09:59 AM
Registered User
 
Join Date: Dec 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for reply. Below are answers:

Have you included jQuery in your script tag at the top of the page?

yes

Are you sure jQuery is getting loaded (i.e. is the path correct)?

yes


What type of page did you create? aspx or html?

aspx


If you view source are there other scripts being loaded?

can you describe more? I do not understand it.

What version of Visual Studio are you using?

2008

One more question: What version of jquery whould I use? Does it matter or not?
 
Old December 9th, 2009, 10:04 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Any chance you could show us the source? Have you included the end tag for the script element:

<script src="jquery.js" type="text/javascript" /> - this doesn't always work
<script src="jquery.js" type="text/javascript"></script> - this always works
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old December 9th, 2009, 10:20 AM
Registered User
 
Join Date: Dec 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is html. I copied all files into root.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
<head>
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<meta http-equiv='content-language' content='en-us' />
<title>Link</title>
<script type='text/javascript' src='~/jquery.js'></script>
<script type='text/javascript' src='~/Example 1-1.js'></script>
<link type='text/css' href='~/Example 1-1.css' rel='stylesheet' />
</head>
<body>
<p>
jQuery is not loaded.
</p>
</body>
</html>
 
Old December 9th, 2009, 11:06 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You can't use ~ in client side URLs - this only works for ASP.Net server controls (e.g. the ImageUrl for an asp:Image control).
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old December 9th, 2009, 11:20 AM
Registered User
 
Join Date: Dec 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem is "~".
It is working now.
Thank you so much.





Similar Threads
Thread Thread Starter Forum Replies Last Post
undefined offset error trev Beginning PHP 9 January 24th, 2007 04:41 AM
Undefined Index Error rit01 Beginning PHP 0 March 1st, 2006 10:03 AM
Undefined Variable: Error jjmancini Beginning PHP 2 July 27th, 2004 01:38 AM
"DbPool" undefined error. danielh Classic ASP Basics 0 June 22nd, 2003 12:09 PM
"DbPool" undefined error. danielh Classic ASP Basics 0 June 22nd, 2003 12:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.