Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old June 19th, 2009, 06:51 PM
Registered User
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Wish all his examples were in the downloadable code

Working in chapter 2. The area where prev() and next() are used.
I can't get mine to work. As far as I can tell, i've typed mine is line for line as his example shows.

It appears that the UL is not getting the css assigned to it because it still has all the decoration.

Would like to see if what he typed actually works.
  #2 (permalink)  
Old June 19th, 2009, 07:10 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

All of the examples should be in the download. I'll look at the download package and make sure they're all there.

If you post all the code you're using I can give you a hand with troubleshooting it.
  #3 (permalink)  
Old June 19th, 2009, 07:17 PM
Registered User
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by richard.york View Post
All of the examples should be in the download. I'll look at the download package and make sure they're all there.

If you post all the code you're using I can give you a hand with troubleshooting it.
Hi, i found the code. It was in the Figures folder. I didn't see it until just now.


Thanks for the offer on helping...

My HTML
Code:
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang='en'>
<head>
<title>Example</title>
<metahttp-equiv='content-type'content='text/html; charset=utf-8'/>
<metahttp-equiv='content-language'content='en-us'/>
<scripttype="text/javascript"src="../JS/jquery-1.3.2.js"></script>
<!-- Rename the files here -->
<scripttype="text/javascript"src="../JS/Example2-2.js"></script>
<linktype="text/css"href="../CSS/Example2-2.css"rel="Stylesheet"/>
</head>
<body>
<h4>Colors</h4>
<ulid='tmpColors'>
<li>Red</li>
<li>Blue</li>
<li>Green</li>
<liid='tmpYellow'>Yellow</li>
<li>Orange</li>
<li>Purple</li>
</ul>
</body>
</html>
My CSS
Code:
body
{
font: 16pxsans-serif;
}
h4
{
font-size: 16px;
margin: 005px0;
}
ul#tmpColors
{
list-style: none;
margin: 0;
padding: 0;
}
 
ul#tmpColorsli
{
margin: 1px;
padding: 3px;
}
 
li.tmpSibling
{
background: #165b91;
color: Fuchsia;
}

My JavaScript
Code:
var tmpExample = {
ready: function() {
$('li#tmpYellow').prev().addClass('tmpSibling');
}
};
$(document).ready(tmpExample.ready);

Last edited by RickBlacker; June 19th, 2009 at 08:35 PM..
  #4 (permalink)  
Old June 19th, 2009, 07:20 PM
Registered User
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmm.. sorry about the formatting... I thought you were supposed to wrap HTML, CSS, and JavaScript in the <code> tags when you post, but that didn't seem to help
  #5 (permalink)  
Old June 19th, 2009, 07:35 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

OK, after some investigation I found that there was some stuff missing from the download. There's supposed to be a folder with the jQuery source code, and another folder containing various images that I use throughout the book. I have notified the Wrox folks about that, and they should have an updated download posted soon.

As for the code that you posted, it looks like it should work. I'm guessing that you may have the path to jQuery or the CSS file wrong?
  #6 (permalink)  
Old June 19th, 2009, 07:45 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

I posted the updated download on my own site as well:

http://www.deadmarshes.com/jQuery%20Book.zip
  #7 (permalink)  
Old June 19th, 2009, 07:51 PM
Registered User
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by richard.york View Post
As for the code that you posted, it looks like it should work. I'm guessing that you may have the path to jQuery or the CSS file wrong?

Hi Richard... I've tried browsing in both IE 8 and Firefox. I've used Firebug and I can see that both JS files are being found, I can also tell that the style is being applied to the html. However, only part of it... The body itself is getting the style specified in the stylesheet... However, the UL is not getting any formatting other that what it inherits from BODY

Odd.

Last edited by RickBlacker; June 19th, 2009 at 07:54 PM..
  #8 (permalink)  
Old June 19th, 2009, 08:10 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Alright, well, I'm not sure what to suggest then. It works for me, I cleaned up the code and tested it and got the expected outcome.

I put everything in the same folder though.

So I still feel like something isn't loading, or perhaps there is something else we aren't thinking of here. You might try typing in the path to each file directly in the browser and verify that each file loads visually.

There is nothing in Firefox's error console?

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0  Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang='en'>
  <head>
    <title>Example</title>
    <meta http-equiv='content-type' content='text/html; charset=utf-8' />
    <meta http-equiv='content-language' content='en-us' />
    <script type="text/javascript" src="jQuery.js"></script>
    <!-- Rename the files here -->
    <script type="text/javascript" src="test.js"></script>
    <link type="text/css" href="test.css" rel="Stylesheet"/>
  </head>
<body>
  <h4>Colors</h4>
  <ul id='tmpColors'>
    <li>Red</li>
    <li>Blue</li>
    <li>Green</li>
    <li id='tmpYellow'>Yellow</li>
    <li>Orange</li>
    <li>Purple</li>
  </ul>
 </body>
</html>
Code:
var tmpExample = {
  ready: function()
  {
    $('li#tmpYellow').prev().addClass('tmpSibling');
  }
};

$(document).ready(tmpExample.ready);
Code:
body {
  font: 16px sans-serif;
}
h4 {
  font-size: 16px;
  margin: 0 0 5px 0;
}
ul#tmpColors {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul#tmpColors li {
  margin: 1px;
  padding: 3px;
}
li.tmpSibling {
  background: #165b91;
  color: Fuchsia;
}
  #9 (permalink)  
Old June 19th, 2009, 08:40 PM
Registered User
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok ok ok....

I'm an IDIOT!!!!

I was referencing the wrong JS and CSS files. I was referencing the old ones from the 2-2 example.

DAMN, that was driving me nuts, but glad I found it.


And Richard? Thanks for you AWESOME help and support!
  #10 (permalink)  
Old June 19th, 2009, 08:47 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

No worries man, we've all been there.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't find the downloadable code trixiebr VB How-To 0 October 6th, 2004 02:59 PM
Cant find downloadable code for book cjmarek C# 4 August 19th, 2004 01:55 PM
Looking for downloadable code derpflug Wrox Book Feedback 2 December 5th, 2003 04:48 PM





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