[jQuery] Re: Looking for that plugin that uses scrollTo for product demos...

2010-01-03 Thread kgosser
bump. any thoughts?

On Dec 17 2009, 6:24 pm, kgosser kgos...@gmail.com wrote:
 Hey all,

 I saw this site a few months ago that was showing off a new plugin
 which used the scrollTo tool to scroll through one screen shot. I
 can't seem to find it with a Google search, and I forgot to save it to
 my Delicious. Yikes!

 I was wondering if this rings a bell for anyone and if you could
 direct me to that site?

 Thanks!


[jQuery] Looking for that plugin that uses scrollTo for product demos...

2009-12-17 Thread kgosser
Hey all,

I saw this site a few months ago that was showing off a new plugin
which used the scrollTo tool to scroll through one screen shot. I
can't seem to find it with a Google search, and I forgot to save it to
my Delicious. Yikes!

I was wondering if this rings a bell for anyone and if you could
direct me to that site?


Thanks!


[jQuery] Callback function after switchClass()

2009-05-12 Thread kgosser

Hey all,

I'm trying to do some animation designs. Basically where I'm stuck is
I have a bunch of things I want to do, but not until the duration of
the switchClass method is complete. Looking at the UI documentation
site, there doesn't appear to be a callback ability.

Anyone have any tips on how I can make a callback on the switchClass?
Thanks.


[jQuery] animate color over time using Timers plugin

2009-04-24 Thread kgosser

Hey all,

I'm using the Timers plugin to do a count down timer. I like it a lot.

I would like to enhance my UI by having the numbering being counted
down transition from black to red as it gets closer to 0.

The jQuery UI demo for animate seems to be what I need, but what I'm
having trouble figuring out is how to have it transition gracefully
over time. It seems like the animation is a one-shot deal.

Any help or tips with this? Thanks.


http://jqueryui.com/demos/animate/


[jQuery] So .change() doesn't work immediately in IE and we have to use .click(). But what about tab+spacebar users?

2009-04-20 Thread kgosser

Been looking up why my .change() isn't working in IE6/7. Found some
good links online to explain that the .change() doesn't work in IE
until AFTER you click or tab away from the radio button or checkbox
for those browsers. Then, it was recommended to use .click() instead.

Ok, fair enough, but the big usability question then:

What about the users who are tabbing through a form and use spacebar
on the keyboard to highlight or change a radio button or checkbox? Are
they pretty much out of luck for getting a script to work that DEPENDS
on the usability purpose of onChange?


[jQuery] Any benefit to using event.preventDefault() over return false to cancel out an href click?

2009-04-20 Thread kgosser

Just curious if there is a best practice when choosing between

$(a).click(function(){
   // stuff
   return false;
});

and

$(a).click(function(){
   // stuff
   event.preventDefault();
});

to cancel out the href of an anchor when clicked.

Thanks in advance for the help.


[jQuery] Re: Any benefit to using event.preventDefault() over return false to cancel out an href click?

2009-04-20 Thread kgosser

Thanks, John.

So is it advisable to use one form or another?

I've used return false throughout my app, and I'm trying to decide if
it's a best practice to change it to preventDefault() if it's wiser to
do so.

On Apr 20, 2:26 pm, John Resig jere...@gmail.com wrote:
 return false does e.preventDefault() and e.stopPropagation().

 --John

 On Mon, Apr 20, 2009 at 3:20 PM, kgosser kgos...@gmail.com wrote:

  Just curious if there is a best practice when choosing between

  $(a).click(function(){
    // stuff
    return false;
  });

  and

  $(a).click(function(){
    // stuff
    event.preventDefault();
  });

  to cancel out the href of an anchor when clicked.

  Thanks in advance for the help.


[jQuery] Re: passing more than 1 param via click()?

2009-04-19 Thread kgosser

Bump. I'm really looking for a solid tip here :). Thanks everyone.

On Apr 17, 9:48 am, kgosser kgos...@gmail.com wrote:
 Here's a better example with HTML. See, I said it was hard to explain
 in the first place :).

 Ok, so basically think of this as a list of things where the HTML is
 always going to be the same, but there could be between 1 and N rows.
 I'm trying to remove the onClick, and target just the link's class so
 that when a specific link is licked, that specific row is removed.

 Here's some example HTML iterated:

 div id=123
         h1Example A/h1
         a href=#remove  class=remove-link onclick=removeDept
 ('123','listA');return false;Remove/a
 /div
 div id=456
         h1Example B/h1
         a href=#remove class=remove-link onclick=remove
 ('456','listB');return false;Remove/a
 /div

 I want to take out the onClick. So here's what I got in the
 JavaScript:

 $(document).ready(function(){
         // consider the example 123 as the dynamic ROW_ID
         // consider the example listA as the dynamic  LIST_ID
         $(.remove-link).click(function(){
                 exampleAjaxFunction(ROW_ID,LIST_ID,function(){
                         // call back if deleted from DB
                         $(this).parent().remove();
                 });
                 return false;
         });

 });

 And so my question is. I don't know how to pass ROW_ID and LIST_ID
 to the single function like the onClick could.. Normally with just one
 param to pass, I could grab it by targeting an a's rel attribute.
 But now there are TWO, and that's my point...There has to be a better
 way to get those than just getting attributes, and that's what I'm
 trying to figure out.

 Thanks for the help again everyone.

 On Apr 17, 12:15 am, Michael Geary m...@mg.to wrote:

  I must be missing something obvious, but it sounds like you're not just
  working with some predetermined HTML, but you have the flexibility to tweak
  that HTML code, is that right?

  Then why can't you generate this as part of your HTML page:

      script type=text/javascript
          // initialize some variables here
      /script

  That *is* HTML code, isn't it?

  -Mike

   From: kgosser

   I have two values that are only found in a loop in the HTML.
   They need to be passed to the single function in the document.ready().

   I can't set them in the JavaScript. I have to find them
   somehow in the HTML. Whether I find them as hidden inputs or
   something, or as tags to the anchor, or as params passed in
   somehow. I'm not sure what's best.


[jQuery] Re: passing more than 1 param via click()?

2009-04-17 Thread kgosser

Here's a better example with HTML. See, I said it was hard to explain
in the first place :).

Ok, so basically think of this as a list of things where the HTML is
always going to be the same, but there could be between 1 and N rows.
I'm trying to remove the onClick, and target just the link's class so
that when a specific link is licked, that specific row is removed.

Here's some example HTML iterated:

div id=123
h1Example A/h1
a href=#remove  class=remove-link onclick=removeDept
('123','listA');return false;Remove/a
/div
div id=456
h1Example B/h1
a href=#remove class=remove-link onclick=remove
('456','listB');return false;Remove/a
/div

I want to take out the onClick. So here's what I got in the
JavaScript:

$(document).ready(function(){
// consider the example 123 as the dynamic ROW_ID
// consider the example listA as the dynamic  LIST_ID
$(.remove-link).click(function(){
exampleAjaxFunction(ROW_ID,LIST_ID,function(){
// call back if deleted from DB
$(this).parent().remove();
});
return false;
});
});

And so my question is. I don't know how to pass ROW_ID and LIST_ID
to the single function like the onClick could.. Normally with just one
param to pass, I could grab it by targeting an a's rel attribute.
But now there are TWO, and that's my point...There has to be a better
way to get those than just getting attributes, and that's what I'm
trying to figure out.

Thanks for the help again everyone.

On Apr 17, 12:15 am, Michael Geary m...@mg.to wrote:
 I must be missing something obvious, but it sounds like you're not just
 working with some predetermined HTML, but you have the flexibility to tweak
 that HTML code, is that right?

 Then why can't you generate this as part of your HTML page:

     script type=text/javascript
         // initialize some variables here
     /script

 That *is* HTML code, isn't it?

 -Mike

  From: kgosser

  I have two values that are only found in a loop in the HTML.
  They need to be passed to the single function in the document.ready().

  I can't set them in the JavaScript. I have to find them
  somehow in the HTML. Whether I find them as hidden inputs or
  something, or as tags to the anchor, or as params passed in
  somehow. I'm not sure what's best.


[jQuery] passing more than 1 param via click()?

2009-04-16 Thread kgosser

Hey all,

Not really sure how to ask this, so I'm sorry if my title is mis-
leading. It is also why I wasn't able to find much searching, so I'm
sorry if it's answered already.

Basically, the code I inherited was this:

a
 href=#drop
 class=edit-link
 onclick=
  removeDept('c:out value=${key} /','c:out value=$
{name} /');
  return false;
Remove Department/a

And that is in an iteration, so the two values passed to the
removeDept function are always dynamic.

I'm trying to handle this in the document.ready(). Normally, I throw
the would-be dynamic param passed as a rel tag on an anchor, and
that's how I retrieve things when I clean up code like this.

However, I'm scratching my head for the *best* way to handle this with
the two params now... How do you guys recommend I handle something
like that?

$(document).ready(function() {
$(.edit-link).click(function(){
   removeDept($(this).attr(rel),$(this).attr(rel));
   return false;
});
});



Obviously I can't have two rel attributes :)


Thanks in advance.


[jQuery] Re: passing more than 1 param via click()?

2009-04-16 Thread kgosser

I think you've misunderstood my question.

I have two values that are only found in a loop in the HTML. They need
to be passed to the single function in the document.ready().

I can't set them in the JavaScript. I have to find them somehow in
the HTML. Whether I find them as hidden inputs or something, or as
tags to the anchor, or as params passed in somehow. I'm not sure
what's best.

Basically, there could be 10 edit-link classes, but when a specific
edit-link anchor is clicked, I need to perform an Ajax function that
needs two params passed into it that are unique to that edit-link.

On Apr 16, 4:53 pm, Joseph Le Brech jlebr...@hotmail.com wrote:
 i think itll be covered in this.

 http://stackoverflow.com/questions/224820/how-do-you-pass-arguments-t...



  Date: Thu, 16 Apr 2009 14:46:41 -0700
  Subject: [jQuery] passing more than 1 param via click()?
  From: kgos...@gmail.com
  To: jquery-en@googlegroups.com

  Hey all,

  Not really sure how to ask this, so I'm sorry if my title is mis-
  leading. It is also why I wasn't able to find much searching, so I'm
  sorry if it's answered already.

  Basically, the code I inherited was this:

  a
       href=#drop
       class=edit-link
       onclick=
            removeDept('c:out value=${key} /','c:out value=$
  {name} /');
            return false;
  Remove Department/a

  And that is in an iteration, so the two values passed to the
  removeDept function are always dynamic.

  I'm trying to handle this in the document.ready(). Normally, I throw
  the would-be dynamic param passed as a rel tag on an anchor, and
  that's how I retrieve things when I clean up code like this.

  However, I'm scratching my head for the *best* way to handle this with
  the two params now... How do you guys recommend I handle something
  like that?

  $(document).ready(function() {
     $(.edit-link).click(function(){
                 removeDept($(this).attr(rel),$(this).attr(rel));
                 return false;
     });
  });

  Obviously I can't have two rel attributes :)

  Thanks in advance.

 _
 View your Twitter and Flickr updates from one place – Learn 
 more!http://clk.atdmt.com/UKM/go/137984870/direct/01/


[jQuery] Re: passing more than 1 param via click()?

2009-04-16 Thread kgosser

That's a good point, Josh. I thought of that earlier, but I wanted to
make sure this was the best way. For only passing two params, that's
not that bad of an idea, but I was checking to see if there was a best
practice here, like hopefully passing the params through somehow.

On Apr 16, 5:04 pm, Josh Nathanson joshnathan...@gmail.com wrote:
 You could do something like:

 a rel=val1_val2 // use a delimiter that makes sense for your values

 Then split the rel:

 var arr = this.rel.split('_'), val1 = arr[0], val2 = arr[1];

 removeDept( val1, val2 );

 -- Josh

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of kgosser
 Sent: Thursday, April 16, 2009 2:47 PM
 To: jQuery (English)
 Subject: [jQuery] passing more than 1 param via click()?

 Hey all,

 Not really sure how to ask this, so I'm sorry if my title is mis-
 leading. It is also why I wasn't able to find much searching, so I'm
 sorry if it's answered already.

 Basically, the code I inherited was this:

 a
      href=#drop
      class=edit-link
      onclick=
           removeDept('c:out value=${key} /','c:out value=$
 {name} /');
           return false;
 Remove Department/a

 And that is in an iteration, so the two values passed to the
 removeDept function are always dynamic.

 I'm trying to handle this in the document.ready(). Normally, I throw
 the would-be dynamic param passed as a rel tag on an anchor, and
 that's how I retrieve things when I clean up code like this.

 However, I'm scratching my head for the *best* way to handle this with
 the two params now... How do you guys recommend I handle something
 like that?

 $(document).ready(function() {
         $(.edit-link).click(function(){
                removeDept($(this).attr(rel),$(this).attr(rel));
                return false;
         });
 });

 Obviously I can't have two rel attributes :)

 Thanks in advance.


[jQuery] Should $(document).ready() be external? And should it be placed at the bottom of the page?

2009-04-14 Thread kgosser

Hey all,

Two quick questions for you. I couldn't find the answers while
searching... This would be a great thing to add to the jQuery FAQ, by
the way.


(1) Is it advisable to place a page's $(document).ready() stuff in an
external .js file?

I've been doing a lot of reading and research on optimizing my front
end code, and YSlow seems to make a big deal of placing code
externally if possible for caching reasons. I understand the
usefulness of placing the code in an external document for that
reason, however, the problem is that there are a lot of functions for
button and link clicks, shows/hides, etc., that are unique to that
page and used differently on other pages.

Thus, putting it externally means it would most likely have to be in
an independent file just for that page... which means an added HTTP
request which is really the speed killer.

So anyways, looking for thoughts on this one.


(2) Is it advisable to place the $(document).ready() at the bottom of
the page right before the closing BODY tag?

Also when doing my research, I've seen that YSlow makes a big deal of
this as well. I'm sure many of you on here have discussed it or
thought about it yourself.

My question though is does it make sense to put the ready() code at
the bottom? Does it help? Is it useful? Will it break?


Thanks in advance for any feedback. Take care everyone.


[jQuery] Re: Should $(document).ready() be external? And should it be placed at the bottom of the page?

2009-04-14 Thread kgosser

So do you think placing it in an external file poses caching benefits
that outweigh the extra HTTP request? The number of HTTP requests
seems to be the biggest killer with speed

On Apr 14, 10:34 am, Andy Matthews li...@commadelimited.com wrote:
 You can externalize the document.ready call if you choose, I do it all the
 time.

 As for putting it at the bottom of the page, I'd say no. Putting it in an
 external JS file, with the ready call makes it so that code is not run until
 the entire DOM is ready anyway.

 andy

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of kgosser
 Sent: Tuesday, April 14, 2009 10:28 AM
 To: jQuery (English)
 Subject: [jQuery] Should $(document).ready() be external? And should it be
 placed at the bottom of the page?

 Hey all,

 Two quick questions for you. I couldn't find the answers while searching...
 This would be a great thing to add to the jQuery FAQ, by the way.

 (1) Is it advisable to place a page's $(document).ready() stuff in an
 external .js file?

 I've been doing a lot of reading and research on optimizing my front end
 code, and YSlow seems to make a big deal of placing code externally if
 possible for caching reasons. I understand the usefulness of placing the
 code in an external document for that reason, however, the problem is that
 there are a lot of functions for button and link clicks, shows/hides, etc.,
 that are unique to that page and used differently on other pages.

 Thus, putting it externally means it would most likely have to be in an
 independent file just for that page... which means an added HTTP request
 which is really the speed killer.

 So anyways, looking for thoughts on this one.

 (2) Is it advisable to place the $(document).ready() at the bottom of the
 page right before the closing BODY tag?

 Also when doing my research, I've seen that YSlow makes a big deal of this
 as well. I'm sure many of you on here have discussed it or thought about it
 yourself.

 My question though is does it make sense to put the ready() code at the
 bottom? Does it help? Is it useful? Will it break?

 Thanks in advance for any feedback. Take care everyone.


[jQuery] Parsing an external RSS feed

2009-02-11 Thread kgosser

Hey all,

I've done some digging for a jQuery RSS feed plugin. Some good ones
out there.
jFeed: 
http://www.hovinne.com/blog/index.php/2007/07/15/132-jfeed-jquery-rss-atom-feed-parser-plugin
Other: http://www.levelfield.com/rss.html
FeedReader: 
http://blogs.atalayasec.org/dev/2008/02/jquery-rss-feed-reader-plugin/

Some GoogleGroup discussion already with local solutions:
http://groups.google.com/group/jquery-en/browse_thread/thread/3c2d9a352ed93586/d4af283e8e6753e2?lnk=gstq=rss#d4af283e8e6753e2

Here's the thing... I could get all of them to work, but only with
local feeds. When I try to load an external RSS feed, I get this error
in Firebug:

Access to restricted URI denied code: 1012
[Break on this error] xhr.open(type,s.url,s.async);try{if(s.da...
[s.url]=modRes;if(!jsonp)success();}else



Can anyone help me on how to take the local solutions above and add in
a bit of extra code to work with external feeds as well?

Note that I'm working in Java not PHP, so jFeed's proxy won't help.
(But I'm a front-end designer, not Java dev, so I don't know how to
parse it with Java).


[jQuery] Beginner question: Using a function inside of an external plugin

2009-01-29 Thread kgosser

Hello all,

This is a beginner question, and may well be more of a JavaScript
answer than a jQuery answer. None the less, here is my example:

I'm using the ultra lightweight Rich Text Editor plugin (http://
batiste.dosimple.ch/blog/posts/2007-09-11-1/rich-text-editor-
jquery.html)

It is called via it's jquery.rte.js file. In that JS file, he has his
main function set up:

jQuery.fn.rte = function(css_url, media_url) {
   // stuff
}

Inside of that, he has his disableDesignMode function that I need to
some how tap into via other controls than just the disable button he
gives in the toolbar. Here's the function:

function disableDesignMode(iframe, submit) {
var content =
iframe.contentWindow.document.getElementsByTagName(body)
[0].innerHTML;
if(submit==true)
var textarea = $('input type=hidden /');
else
var textarea = $('textarea cols=40 rows=10/
textarea');
textarea.val(content);
t = textarea.get(0);
if(iframe.className)
t.className = iframe.className;
if(iframe.id)
t.id = iframe.id;
if(iframe.title)
t.name = iframe.title;
$(iframe).before(textarea);
if(submit!=true)
$(iframe).remove();
return textarea;
}



So, with that said... my question is how do I go about accessing that
disableDesignMode function, when it's private to his plugin
function? Do I extend it somehow? If so, how?

Thanks in advance. This is a big learning point for me with JS and
jQuery, so any help is greatly appreciated.


[jQuery] Is .parent() only one level up?

2009-01-28 Thread kgosser

Hello, pretty noob question here. I have this example:

div
   form
  div
  labelExample/label
  input type=text/
  /div
   /form
/div


Now let's say there's this jQuery:

$(input).click(function(){
   $(this).parent(form).css(color,#F00);
});


My question: Does the parent() method work like that, or do I need to
do something like $(this).prev().prev() to get to the form? I guess
I'm trying to better understand how flexible the parent() and children
() methods are.

Thanks in advance.


[jQuery] Re: Is .parent() only one level up?

2009-01-28 Thread kgosser

No, not necessarily, but thanks for the link. I'll take a deeper look
at that.

What my question centers around is when I put parent(example); ...
how far up the tree does jQuery look for the example -- just one
level, or higher?

The key is I'm trying to understand how to stop having to write
traversing like this:

$(this).parent.().parent().prev().prev().prev().children(p.example);

If you see what I'm getting at?

On Jan 28, 11:42 am, jay jay.ab...@gmail.com wrote:
 http://docs.jquery.com/Traversing/closest

 On Jan 28, 12:39 pm, kgosser kgos...@gmail.com wrote:

  Hello, pretty noob question here. I have this example:

  div
     form
        div
            labelExample/label
            input type=text/
        /div
     /form
  /div

  Now let's say there's this jQuery:

  $(input).click(function(){
     $(this).parent(form).css(color,#F00);

  });

  My question: Does the parent() method work like that, or do I need to
  do something like $(this).prev().prev() to get to the form? I guess
  I'm trying to better understand how flexible the parent() and children
  () methods are.

  Thanks in advance.


[jQuery] Superfish does not work in IE6. Including Superfish's actual site.

2008-11-20 Thread kgosser

Hey John,

I downloaded Superfish the other day and have been using it. It seems
like the right kind of tool for the project I'm tackling, and I'm
excited about it!

It's been working like a charm so far, but today, I began to start
evaluating it in IE6. I've ran into two very large issues:

(1) It seems like this CSS on the anchors:

.sf-menu a { float: left; }

Crashes the browser. I couldn't find a work around for it.

(2) When viewing a superfish menu in IE6, the drop downs would never
work. This includes my personal project I'm working on, and your
actual site for Superfish, http://users.tpg.com.au/j_birch/plugins/superfish/.

First, the system I'm running is Parallels on OSX10.5, with Windows XP
SP1, IE6 from Multiple IE. I will acknowledge that it could be an
issue with the actual build of the browser in my Parallels, but it is
something important enough to pass along.


So, are these issues specific to my browser build? Did I miss some
sort of extra conditional include or something for IE6? Any help would
be greatly appreciated!


[jQuery] Re: How do I reset to the original positions of a sortable list? (using the .sortable() method)

2008-11-17 Thread kgosser

Bumpity bump. Any tips? Thanks in advance!

On Nov 14, 3:57 pm, kgosser [EMAIL PROTECTED] wrote:
 Hey all,

 I'm using this sortable method:http://docs.jquery.com/UI/Sortables/sortable

 Works perfect! I have one question though: When a certain action is
 taken by the user, I want to reset the original order of the lis in
 the list. I can't seem to figure out how to do that. Does anyone have
 any tips?

 Thanks!


[jQuery] How do I reset to the original positions of a sortable list? (using the .sortable() method)

2008-11-14 Thread kgosser

Hey all,

I'm using this sortable method: http://docs.jquery.com/UI/Sortables/sortable

Works perfect! I have one question though: When a certain action is
taken by the user, I want to reset the original order of the lis in
the list. I can't seem to figure out how to do that. Does anyone have
any tips?

Thanks!


[jQuery] Check if an element DOESN'T have a class

2008-10-21 Thread kgosser

Hey all,

I understand how hasClass() works, but I'm trying to figure out how to
use it to see if an element DOESN'T have a class. I want to check if
the class doesn't exist, and if not then I'll add it.

Do I use the older is() method?

Just looking for the best way. Thanks!


[jQuery] Re: Any plug-ins that deal with formatting text?

2008-09-24 Thread kgosser

Do you or anyone else have any suggestions, or experience with any of
the options?

On Sep 23, 9:37 pm, Richard D. Worth [EMAIL PROTECTED] wrote:
 If you're looking for formatting in an actual textarea (not a rich
 editor/iframe), look no further than markItUp!:

 http://markitup.jaysalvat.com/home/

 If you want more full-fledged wysiwyg editing, there a quite a few more
 options:

 jwysiwyghttp://code.google.com/p/jwysiwyg/
 WYMEditorhttp://www.wymeditor.org/
 TinyMCE (not jQuery based, but works with jQuery)http://tinymce.moxiecode.com/

 Also, you can search the plugin repository:

 http://plugins.jquery.com/search/node/wysiwyg+type%3Aproject_project

 - Richard

 On Tue, Sep 23, 2008 at 3:09 PM, kgosser [EMAIL PROTECTED] wrote:

  Hey all,

  I'm looking for a jQuery plug-in that will help with formatting text
  in a textarea. Something like Wordpress' or Gdoc's formatting bar.

  Basically I want to be able to bold/italicize/etc. text for users
  without them having to understand HTML.

  Any direction to an existing plug-in would be greatly appreciated!


[jQuery] Any plug-ins that deal with formatting text?

2008-09-23 Thread kgosser

Hey all,

I'm looking for a jQuery plug-in that will help with formatting text
in a textarea. Something like Wordpress' or Gdoc's formatting bar.

Basically I want to be able to bold/italicize/etc. text for users
without them having to understand HTML.

Any direction to an existing plug-in would be greatly appreciated!


[jQuery] using doc.ready in an external .js file

2008-07-08 Thread kgosser

Here's what I'm not getting about jQuery from a novice point of view.
Let's say I have this:

script type=text/javascript
$(document).ready(function() {
$(#switcherBtn).click(function(){
$(#target).toggleClass(nodisplay);
});
});
/script

I have a function to toggle the display of a certain div. This div is
on virtually all my pages, though, so instead of putting this in the
header of each page, I want to put it in a global include file, for
example main.js.

I don't understand why copying and pasting

$(document).ready(function() {
$(#switcherBtn).click(function(){
$(#target).toggleClass(nodisplay);
});
});

into main.js throws this error in Firebug:

$ is not defined
main.js()()main.js (line 1)
$(document).ready(function(){



Any input?


[jQuery] Re: using doc.ready in an external .js file

2008-07-08 Thread kgosser

Bingo, that was it. Big time duh noob moment :)

On Jul 8, 4:50 pm, Carl Von Stetten [EMAIL PROTECTED] wrote:
 kgosser,

 Are you loading jQuery.js after your main.js file?  If you are, try
 loading jQuery first, as it must be present before using any of its
 functions.

 Carl

 kgosser wrote:
  Here's what I'm not getting about jQuery from a novice point of view.
  Let's say I have this:

 script type=text/javascript
 $(document).ready(function() {
 $(#switcherBtn).click(function(){
 $(#target).toggleClass(nodisplay);
 });
 });
 /script

  I have a function to toggle the display of a certain div. This div is
  on virtually all my pages, though, so instead of putting this in the
  header of each page, I want to put it in a global include file, for
  example main.js.

  I don't understand why copying and pasting

 $(document).ready(function() {
 $(#switcherBtn).click(function(){
 $(#target).toggleClass(nodisplay);
 });
 });

  into main.js throws this error in Firebug:

  $ is not defined
  main.js()()main.js (line 1)
  $(document).ready(function(){

  Any input?