Douglas Muth on 29 Jan 2009 06:04:40 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] OT: Javascript question


On Wed, Jan 28, 2009 at 11:50 PM, Eric <eric@lucii.org> wrote:
> Not sure where to go with this... it's not really liunx although I'm
> developing it on a Linux system :-)

I don't know the cause of the problem, but I can tell you that the
approach you are taking is unnecessarily complicated, and not making
full use of what jQuery has to offer.  To wit:

1) You don't need to loop through all of the links once they're
created.  Use jQuery's selectors to do it for you. aka:

 $("#outer_div_id").find("a").each(function() {
   // Code goes here
   });

Alternatively, you could set a style class for all of the links you
create, and iterate through them like this::

$(".class_type").each(...


2) Don't use bind(), use click(), aka:

$(element).click(function() {
   // Code
   });


3) Don't use loadXMLDoc(), use jQuery's $.get() function or similar.


You might want to spend some time brushing up on all that can be done
with jQuery, by looking at the "API Reference" section under
http://docs.jquery.com/Main_Page, as well as www.visualjquery.com.

-- Doug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug