Saturday, February 28, 2009

[jQuery] Re: How to find a parent

And that's what happens when you type a long-winded response, it
becomes redundant by the time you hit send :)

On Feb 28, 10:03 pm, mkmanning <michaell...@gmail.com> wrote:
> The statement "it has a parent div.popup somewhere up the tree (no
> idea how many levels)" implies to me that div.popup may not be the
> direct parent of "Cancel". Parent() returns the unique parent, so
> there will be only one for each element; in the above case $
> (this).parent() will return the unique parent element of "this". If
> "this" is a child (not a descendant) of div.popup, it will be returned
> without having to pass any expression to the selector. If it's not a
> child but a descendant (and the quoted statement indicates that could
> be the case), then passing the div.popup expression will filter out
> the parent and return an empty object.
>
> .parents() traverses up the tree, through all parents, and then :first
> returns the first matching element for the expression div.popup
>
> Consider this markup:
> <div id="one" class="popup">
>         <div id="two" class="popup">
>                 <div id="three" class="popup">
>                         <div id="four" class="notpopup">
>                                 <a id="cancel">test</a>
>                         </div>
>                 </div>
>         </div>
> </div>
>
> Calling $('#cancel').parent() would return  [div#four.notpopup] as
> that is the unique parent for the link. Adding the expression
> div.popup will filter out that parent as it won't match (and
> adding :first on top of that will obviously have no effect as a non-
> match has already occurred). The :first selector implies having more
> than one match, which is what you get with .parents()
>
> If you try on the above markup you'll get  [div#three.popup,
> div#two.popup, div#one.popup] as we traverse up the tree.
> Using :first then filters those matches to the first match, so $
> ('#cancel').parents('div.popup:first') returns  [div#three.popup],
> which is the first parent div with a class of popup.
>
> On Feb 28, 9:33 pm, "Rick Faircloth" <R...@WhiteStoneMedia.com> wrote:
>
> > Hmmm...after looking at the docs, it would seem
> > "parent" would be more appropriate since Kim is
> > looking for the first parent of the link '#cancel'.
>
> > Why would you think it should be "parents" which
> > would return more than the first parent.
>
> > Am I misunderstanding something?
>
> > Rick
>
> > -----Original Message-----
> > From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
>
> > Behalf Of Rick Faircloth
> > Sent: Sunday, March 01, 2009 12:26 AM
> > To: jquery-en@googlegroups.com
> > Subject: [jQuery] Re: How to find a parent
>
> > Thanks for the tip!
>
> > Rick
>
> > -----Original Message-----
> > From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
> > Behalf Of mkmanning
> > Sent: Sunday, March 01, 2009 12:18 AM
> > To: jQuery (English)
> > Subject: [jQuery] Re: How to find a parent
>
> > It should be .parents
>
> >   $(this).parents('div.popup:first')
>
> > On Feb 28, 9:05 pm, "Rick Faircloth" <R...@WhiteStoneMedia.com> wrote:
> > > Assuming that the cancel link has an id of 'cancel':
>
> > > How about:
>
> > > $(document).ready(function() {
>
> > >      $('#cancel').click(function() {
> > >                 $(this).parent('div.popup:first')
> > >      });
>
> > > });
>
> > > Not sure what you want to do with the parent div when you locate it...
>
> > > untested, buy may work...
>
> > > hth,
>
> > > Rick
>
> > > -----Original Message-----
> > > From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com]
> > > On
>
> > > Behalf Of riotbrrd
> > > Sent: Saturday, February 28, 2009 11:47 PM
> > > To: jQuery (English)
> > > Subject: [jQuery] How to find a parent
>
> > > I have a bunch of Divs with class ".popup". Each div is different in
> > > what it contains; some are simple, some are pretty complex, containing
> > > tables, other divs, etc..
>
> > > If I have a link, for example,"Cancel", within that Div, and the only
> > > thing that I know about Cancel is that 1) it has a parent div.popup
> > > somewhere up the tree (no idea how many levels), and 2) if I go
> > > backwards up the tree from Cancel, the first div.popup I encounter
> > > will be the right one, how can I go about finding the right parent
> > > div.popup? I'd like to just attach a handler that starts with "this"
> > > (meaning the Cancel link) and finds the correct div.popup up the tree.
>
> > > Hope this is question is clear. Thanks!
> > > -Kim

[jQuery] Re: How to find a parent

The statement "it has a parent div.popup somewhere up the tree (no
idea how many levels)" implies to me that div.popup may not be the
direct parent of "Cancel". Parent() returns the unique parent, so
there will be only one for each element; in the above case $
(this).parent() will return the unique parent element of "this". If
"this" is a child (not a descendant) of div.popup, it will be returned
without having to pass any expression to the selector. If it's not a
child but a descendant (and the quoted statement indicates that could
be the case), then passing the div.popup expression will filter out
the parent and return an empty object.

.parents() traverses up the tree, through all parents, and then :first
returns the first matching element for the expression div.popup

Consider this markup:
<div id="one" class="popup">
<div id="two" class="popup">
<div id="three" class="popup">
<div id="four" class="notpopup">
<a id="cancel">test</a>
</div>
</div>
</div>
</div>

Calling $('#cancel').parent() would return [div#four.notpopup] as
that is the unique parent for the link. Adding the expression
div.popup will filter out that parent as it won't match (and
adding :first on top of that will obviously have no effect as a non-
match has already occurred). The :first selector implies having more
than one match, which is what you get with .parents()

If you try on the above markup you'll get [div#three.popup,
div#two.popup, div#one.popup] as we traverse up the tree.
Using :first then filters those matches to the first match, so $
('#cancel').parents('div.popup:first') returns [div#three.popup],
which is the first parent div with a class of popup.

On Feb 28, 9:33 pm, "Rick Faircloth" <R...@WhiteStoneMedia.com> wrote:
> Hmmm...after looking at the docs, it would seem
> "parent" would be more appropriate since Kim is
> looking for the first parent of the link '#cancel'.
>
> Why would you think it should be "parents" which
> would return more than the first parent.
>
> Am I misunderstanding something?
>
> Rick
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
>
> Behalf Of Rick Faircloth
> Sent: Sunday, March 01, 2009 12:26 AM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: How to find a parent
>
> Thanks for the tip!
>
> Rick
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
> Behalf Of mkmanning
> Sent: Sunday, March 01, 2009 12:18 AM
> To: jQuery (English)
> Subject: [jQuery] Re: How to find a parent
>
> It should be .parents
>
>   $(this).parents('div.popup:first')
>
> On Feb 28, 9:05 pm, "Rick Faircloth" <R...@WhiteStoneMedia.com> wrote:
> > Assuming that the cancel link has an id of 'cancel':
>
> > How about:
>
> > $(document).ready(function() {
>
> >      $('#cancel').click(function() {
> >                 $(this).parent('div.popup:first')
> >      });
>
> > });
>
> > Not sure what you want to do with the parent div when you locate it...
>
> > untested, buy may work...
>
> > hth,
>
> > Rick
>
> > -----Original Message-----
> > From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com]
> > On
>
> > Behalf Of riotbrrd
> > Sent: Saturday, February 28, 2009 11:47 PM
> > To: jQuery (English)
> > Subject: [jQuery] How to find a parent
>
> > I have a bunch of Divs with class ".popup". Each div is different in
> > what it contains; some are simple, some are pretty complex, containing
> > tables, other divs, etc..
>
> > If I have a link, for example,"Cancel", within that Div, and the only
> > thing that I know about Cancel is that 1) it has a parent div.popup
> > somewhere up the tree (no idea how many levels), and 2) if I go
> > backwards up the tree from Cancel, the first div.popup I encounter
> > will be the right one, how can I go about finding the right parent
> > div.popup? I'd like to just attach a handler that starts with "this"
> > (meaning the Cancel link) and finds the correct div.popup up the tree.
>
> > Hope this is question is clear. Thanks!
> > -Kim

[jQuery] Re: How to find a parent

You guys rock! thanks.

So, .parents works, .parent does not. I think the reason is
this: .parent only finds the single parent immediately up the tree,
but the div I'm looking for is actually several nodes up. The node
that .parent finds is not a div.popup, so I get no object back.

Thanks again!
-Kim

On Feb 28, 9:33 pm, "Rick Faircloth" <R...@WhiteStoneMedia.com> wrote:
> Hmmm...after looking at the docs, it would seem
> "parent" would be more appropriate since Kim is
> looking for the first parent of the link '#cancel'.
>
> Why would you think it should be "parents" which
> would return more than the first parent.
>
> Am I misunderstanding something?
>
> Rick
>
>
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
>
> Behalf Of Rick Faircloth
> Sent: Sunday, March 01, 2009 12:26 AM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: How to find a parent
>
> Thanks for the tip!
>
> Rick
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
> Behalf Of mkmanning
> Sent: Sunday, March 01, 2009 12:18 AM
> To: jQuery (English)
> Subject: [jQuery] Re: How to find a parent
>
> It should be .parents
>
>   $(this).parents('div.popup:first')
>
> On Feb 28, 9:05 pm, "Rick Faircloth" <R...@WhiteStoneMedia.com> wrote:
> > Assuming that the cancel link has an id of 'cancel':
>
> > How about:
>
> > $(document).ready(function() {
>
> >      $('#cancel').click(function() {
> >                 $(this).parent('div.popup:first')
> >      });
>
> > });
>
> > Not sure what you want to do with the parent div when you locate it...
>
> > untested, buy may work...
>
> > hth,
>
> > Rick
>
> > -----Original Message-----
> > From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com]
> > On
>
> > Behalf Of riotbrrd
> > Sent: Saturday, February 28, 2009 11:47 PM
> > To: jQuery (English)
> > Subject: [jQuery] How to find a parent
>
> > I have a bunch of Divs with class ".popup". Each div is different in
> > what it contains; some are simple, some are pretty complex, containing
> > tables, other divs, etc..
>
> > If I have a link, for example,"Cancel", within that Div, and the only
> > thing that I know about Cancel is that 1) it has a parent div.popup
> > somewhere up the tree (no idea how many levels), and 2) if I go
> > backwards up the tree from Cancel, the first div.popup I encounter
> > will be the right one, how can I go about finding the right parent
> > div.popup? I'd like to just attach a handler that starts with "this"
> > (meaning the Cancel link) and finds the correct div.popup up the tree.
>
> > Hope this is question is clear. Thanks!
> > -Kim- Hide quoted text -
>
> - Show quoted text -

[jQuery] Re: How to find a parent

Hmmm...after looking at the docs, it would seem
"parent" would be more appropriate since Kim is
looking for the first parent of the link '#cancel'.

Why would you think it should be "parents" which
would return more than the first parent.

Am I misunderstanding something?

Rick

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Sunday, March 01, 2009 12:26 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to find a parent


Thanks for the tip!

Rick

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
Behalf Of mkmanning
Sent: Sunday, March 01, 2009 12:18 AM
To: jQuery (English)
Subject: [jQuery] Re: How to find a parent


It should be .parents

$(this).parents('div.popup:first')

On Feb 28, 9:05 pm, "Rick Faircloth" <R...@WhiteStoneMedia.com> wrote:
> Assuming that the cancel link has an id of 'cancel':
>
> How about:
>
> $(document).ready(function() {
>
>      $('#cancel').click(function() {
>                 $(this).parent('div.popup:first')
>      });
>
> });
>
> Not sure what you want to do with the parent div when you locate it...
>
> untested, buy may work...
>
> hth,
>
> Rick
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com]
> On
>
> Behalf Of riotbrrd
> Sent: Saturday, February 28, 2009 11:47 PM
> To: jQuery (English)
> Subject: [jQuery] How to find a parent
>
> I have a bunch of Divs with class ".popup". Each div is different in
> what it contains; some are simple, some are pretty complex, containing
> tables, other divs, etc..
>
> If I have a link, for example,"Cancel", within that Div, and the only
> thing that I know about Cancel is that 1) it has a parent div.popup
> somewhere up the tree (no idea how many levels), and 2) if I go
> backwards up the tree from Cancel, the first div.popup I encounter
> will be the right one, how can I go about finding the right parent
> div.popup? I'd like to just attach a handler that starts with "this"
> (meaning the Cancel link) and finds the correct div.popup up the tree.
>
> Hope this is question is clear. Thanks!
> -Kim

[jQuery] Re: [tooltip] help please

Paul,

Two suggestions:
1) remove the dimensions plugin script (it's integrated into jQuery as of
this version)
2) close your doc ready function with parens & semicolon:
$(function() {
$('#set1 *').tooltip();
});


SEAN O
http://www.sean-o.com

paulmo wrote:
>
>
> am not getting the stylized popup window (generic yellow box instead).
> all files in my server root folder. please help this newbie; this in
> head:
>
> <script type="text/javascript" src="jquery-1.2.6.min.js"></script>
> <script src="jquery.bgiframe.js" type="text/javascript"></script>
> <script src="jquery.tooltip.pack.js" type="text/javascript"></script>
> <script type="text/javascript" src="jquery.tooltip.min.js"></script>
> <script type="text/javascript" src="jquery.dimensions.js"></script>
> <link rel="stylesheet" href="jquery.tooltip.css" />
>
> <script type="text/javascript">
> $(function() {
> $('#set1 *').tooltip();
> }
> </script>
>
> this in body:
>
> <fieldset id="set1">
> <label title="A label with a title and default settings, no href
> here" for="text1">Write something.</label>
> <br/>
> <input title="Your input generates a database driven, interactive
> response based on subject key words." type="text" value="Test"
> name="action" id="text1"/>
>
> </fieldset>
>
>

--
View this message in context: http://www.nabble.com/-tooltip--help-please-tp22269309s27240p22269875.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

[jQuery] Re: google suggest

Have a look at the excellent Autocomplete plugin by Jörn Zaefferer:
http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/


SEAN O
http://www.sean-o.com

anjith wrote:
>
>
> Hi,
>
> Hey please help i want to do google suggest i have customised many
> codes but none of them working . I tired to do own but how to get
> light window below the text box and get suggestions one by one.
>
> Please help me
>
>
> Thanks and regards,
> Anjith Kumar Garapati
>
>

--
View this message in context: http://www.nabble.com/google-suggest-tp22260004s27240p22269874.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

[jQuery] Re: How to find a parent

Thanks for the tip!

Rick

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
Behalf Of mkmanning
Sent: Sunday, March 01, 2009 12:18 AM
To: jQuery (English)
Subject: [jQuery] Re: How to find a parent


It should be .parents

$(this).parents('div.popup:first')

On Feb 28, 9:05 pm, "Rick Faircloth" <R...@WhiteStoneMedia.com> wrote:
> Assuming that the cancel link has an id of 'cancel':
>
> How about:
>
> $(document).ready(function() {
>
>      $('#cancel').click(function() {
>                 $(this).parent('div.popup:first')
>      });
>
> });
>
> Not sure what you want to do with the parent div when you locate it...
>
> untested, buy may work...
>
> hth,
>
> Rick
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com]
> On
>
> Behalf Of riotbrrd
> Sent: Saturday, February 28, 2009 11:47 PM
> To: jQuery (English)
> Subject: [jQuery] How to find a parent
>
> I have a bunch of Divs with class ".popup". Each div is different in
> what it contains; some are simple, some are pretty complex, containing
> tables, other divs, etc..
>
> If I have a link, for example,"Cancel", within that Div, and the only
> thing that I know about Cancel is that 1) it has a parent div.popup
> somewhere up the tree (no idea how many levels), and 2) if I go
> backwards up the tree from Cancel, the first div.popup I encounter
> will be the right one, how can I go about finding the right parent
> div.popup? I'd like to just attach a handler that starts with "this"
> (meaning the Cancel link) and finds the correct div.popup up the tree.
>
> Hope this is question is clear. Thanks!
> -Kim

[jQuery] Re: [tooltip] help please

just went through that download today to implement. I ended up grabbing screen.css from project demo site and found some of the tooltip components on there and all works well



paulmo wrote:
am not getting the stylized popup window (generic yellow box instead). all files in my server root folder. please help this newbie; this in head:  <script type="text/javascript" src="jquery-1.2.6.min.js"></script> <script src="jquery.bgiframe.js" type="text/javascript"></script> <script src="jquery.tooltip.pack.js" type="text/javascript"></script> <script type="text/javascript" src="jquery.tooltip.min.js"></script> <script type="text/javascript" src="jquery.dimensions.js"></script> <link rel="stylesheet" href="jquery.tooltip.css" />  <script type="text/javascript"> $(function() { $('#set1 *').tooltip(); } </script>  this in body:  <fieldset id="set1"> 		<label title="A label with a title and default settings, no href here" for="text1">Write something.</label> 		<br/> 		<input title="Your input generates a database driven, interactive response based on subject key words." type="text" value="Test" name="action" id="text1"/>  	</fieldset>    

[jQuery] Re: How to find a parent

It should be .parents

$(this).parents('div.popup:first')

On Feb 28, 9:05 pm, "Rick Faircloth" <R...@WhiteStoneMedia.com> wrote:
> Assuming that the cancel link has an id of 'cancel':
>
> How about:
>
> $(document).ready(function() {
>
>      $('#cancel').click(function() {
>                 $(this).parent('div.popup:first')
>      });
>
> });
>
> Not sure what you want to do with the parent div
> when you locate it...
>
> untested, buy may work...
>
> hth,
>
> Rick
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
>
> Behalf Of riotbrrd
> Sent: Saturday, February 28, 2009 11:47 PM
> To: jQuery (English)
> Subject: [jQuery] How to find a parent
>
> I have a bunch of Divs with class ".popup". Each div is different in what it
> contains; some are simple, some are pretty complex, containing tables, other
> divs, etc..
>
> If I have a link, for example,"Cancel", within that Div, and the only thing
> that I know about Cancel is that 1) it has a parent div.popup somewhere up
> the tree (no idea how many levels), and 2) if I go backwards up the tree
> from Cancel, the first div.popup I encounter will be the right one, how can
> I go about finding the right parent div.popup? I'd like to just attach a
> handler that starts with "this" (meaning the Cancel link) and finds the
> correct div.popup up the tree.
>
> Hope this is question is clear. Thanks!
> -Kim

[jQuery] Re: How to find a parent

Assuming that the cancel link has an id of 'cancel':

How about:

$(document).ready(function() {

$('#cancel').click(function() {
$(this).parent('div.popup:first')
});
});

Not sure what you want to do with the parent div
when you locate it...

untested, buy may work...

hth,

Rick

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] On
Behalf Of riotbrrd
Sent: Saturday, February 28, 2009 11:47 PM
To: jQuery (English)
Subject: [jQuery] How to find a parent


I have a bunch of Divs with class ".popup". Each div is different in what it
contains; some are simple, some are pretty complex, containing tables, other
divs, etc..

If I have a link, for example,"Cancel", within that Div, and the only thing
that I know about Cancel is that 1) it has a parent div.popup somewhere up
the tree (no idea how many levels), and 2) if I go backwards up the tree
from Cancel, the first div.popup I encounter will be the right one, how can
I go about finding the right parent div.popup? I'd like to just attach a
handler that starts with "this" (meaning the Cancel link) and finds the
correct div.popup up the tree.

Hope this is question is clear. Thanks!
-Kim

[jQuery] Re: JQuery problem trying to read XML from a site (xmlhttp)

dG,

Okay, I tried using Troy Wolf's Proxy php page... It's a little more
than what i needed, but it works just fine.

I think this is something with JQuery itself... For anyone who wants
to look at this, i've uploaded it to my server:
http://ww2.krushradio.com/test/yp/jquery.zip

Now... I wanted to test this to see what exactly is the difference,
and find out if jquery is timing out, or if it's not waiting

First, I tested the proxy to make sure that it's reading the file
correctly...
http://ww2.krushradio.com/test/yp/2/proxy.php?proxy_url=http://yp.krushradio.com/getstream.aspx?stream=stream
Which it is.. that pulls in the correct xml document.. which I've also
used as just krush.xml (http://ww2.krushradio.com/yp/1/krush.xml)

So, I built 2 versions of it, one that pulls the xml from the server
which is live, and 1 that uses the xml from file..
http://ww2.krushradio.com/test/yp/1/index.html and
http://ww2.krushradio.com/test/yp/2/index.html

The one with the flat file works fine, and does what it should. The
other one, does not work.. Technically, the same xml file is being
fed to both using the proxy.php file. So, i'm at a loss... Is there a
wait function that it needs to use... which is what i thought the $
(document).ready(function(){ line is for..

So, i'm on the right track.. it just seems that i'm missing something.

Any thoughts?

~Doc

On Feb 27, 10:31 am, deafGuru <b...@deafCensus.org> wrote:
> Type 'cross domain XML with ajax' in the search field. You will find
> an excellent answer to common problem. Last night it was first time it
> worked magically. If you have own website, you just call "proxy.php"
> in which it calls another domain for XML document, receives and wraps
> it, and return it to your JQuery script for processing.
>
> Firebug would likely tell you it's ACCESS TO RESTRICTED URI error due
> to browser security. Using proxy solves it! Be forewarned that using
> proxy lures great dangers!!!
>
> On Feb 27, 5:24 am, Dor <dor9...@gmail.com> wrote:
>
>
>
> > Is that your website?
>
> > It might be that on the server side, the access to some pages are not
> > allowed if the HTTP_REFERER header is from another website.
> > Try to set the HTTP_REFERER of the AJAX request to an empty string.
>
> > On Feb 27, 6:19 am, KrushRadio - Doc <drega...@gmail.com> wrote:
>
> > > Hey guys,
>
> > > I'm a bit new to JQuery, but from what i've read, it's the end all to
> > > xmlhttprequests.
>
> > > I pulled this from a website and modified it to work on mine.  I'm
> > > using jQuery 1.3.2, btw...
> > > For the life of me, i cannot get it to pull the xml data from
> > > getstream.aspx.  if you open it up in a browser, it shows as perfect
> > > xml.  If i parse it with straight php, it works, but i want to use the
> > > jQuery Library with an ajax refresh.
>
> > > Am I screwing something up, or is there something I don't know about
> > > when using a website source vs. a local source.
>
> > > ~Doc
>
> > > <!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">
> > > <head>
> > >         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
> > >         <link rel="stylesheet" type="text/css" media="all" href="style.css" /
>
> > >         <script type="text/javascript" src="jquery.js"></script>
> > >         <title>Reading XML with jQuery</title>
> > >      <script>
> > >         $(document).ready(function(){
> > >                         $.ajax({
> > >                                 type: "GET",
> > >                                 url: "http://yp.krushradio.com/getstream.aspx?stream=stream",
> > >                                 dataType: "xml",
> > >                                 success: function(xml) {
> > >                                         $(xml).find('activesong').each(function(){
> > >                                                 var stream = $(this).find('servername');
> > >                                                 var title = $(this).find('songname').text();
> > >                                                 var genre = $(this).find('servergenre').text();
> > >                                                 $('<div class="TrackListing"></div>').html(stream+'<br>'+title
> > > +'<br>'+genre+'<br>').appendTo('#page-wrap');
> > >                                         });
> > >                                 }
> > >                         });
> > >                 });
> > >      </script>
> > > </head>
> > > <body>
> > >         <div id="page-wrap">
> > >         <h1>Reading XML with jQuery</h1>
> > >      </div>
> > > </body>
> > > </html>- Hide quoted text -
>
> - Show quoted text -

[jQuery] Re: How to find a parent

$(this).parents('div.popup')

On Feb 28, 8:47 pm, riotbrrd <k...@riotbrrd.com> wrote:
> I have a bunch of Divs with class ".popup". Each div is different in
> what it contains; some are simple, some are pretty complex, containing
> tables, other divs, etc..
>
> If I have a link, for example,"Cancel", within that Div, and the only
> thing that I know about Cancel is that 1) it has a parent div.popup
> somewhere up the tree (no idea how many levels), and 2) if I go
> backwards up the tree from Cancel, the first div.popup I encounter
> will be the right one, how can I go about finding the right parent
> div.popup? I'd like to just attach a handler that starts with
> "this" (meaning the Cancel link) and finds the correct div.popup up
> the tree.
>
> Hope this is question is clear. Thanks!
> -Kim

[jQuery] How to find a parent

I have a bunch of Divs with class ".popup". Each div is different in
what it contains; some are simple, some are pretty complex, containing
tables, other divs, etc..

If I have a link, for example,"Cancel", within that Div, and the only
thing that I know about Cancel is that 1) it has a parent div.popup
somewhere up the tree (no idea how many levels), and 2) if I go
backwards up the tree from Cancel, the first div.popup I encounter
will be the right one, how can I go about finding the right parent
div.popup? I'd like to just attach a handler that starts with
"this" (meaning the Cancel link) and finds the correct div.popup up
the tree.

Hope this is question is clear. Thanks!
-Kim

[jQuery] Re: jcarousel lite plug in help needed

the problem you are having is CSS . There should be a file of CSS to hold all the components of the carousel together. I looked and didn't see one on site for Lite version

read up on CSS. html generates the content but it needs to be displalyed in proper location, color etc with CSS.

The full blown JCarousel incldes the file needed, not sure why Lite doesn't


Can tell you are new at doing this,, look in your browser and see how other pages are structured. In Internet Explorer, right click / view source will pull window up of code for any page.


surreal5335 wrote:
I am creating this carousel with jcarousel lite plug in but instead of getting a carousel I am just getting a vertical static list of images when loading it into a table cell with firefox. I have read that IE is notroious for having this problem as well.  Upon pressing the next and prev buttons the list just hides and shows itself.  I know that plug in is being called properly bc without the call for the script, the toggling of the list with the buttons doesnt work.  I have gone over my code and several times and checked install notes and other demo scripts, but still have same problem.  Here is my link to the page at issue  http://royalvillicus.com/photo_site/photo.html  I appreciate any help in solving this matter    

[jQuery] [tooltip] help please

am not getting the stylized popup window (generic yellow box instead).
all files in my server root folder. please help this newbie; this in
head:

<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script src="jquery.bgiframe.js" type="text/javascript"></script>
<script src="jquery.tooltip.pack.js" type="text/javascript"></script>
<script type="text/javascript" src="jquery.tooltip.min.js"></script>
<script type="text/javascript" src="jquery.dimensions.js"></script>
<link rel="stylesheet" href="jquery.tooltip.css" />

<script type="text/javascript">
$(function() {
$('#set1 *').tooltip();
}
</script>

this in body:

<fieldset id="set1">
<label title="A label with a title and default settings, no href
here" for="text1">Write something.</label>
<br/>
<input title="Your input generates a database driven, interactive
response based on subject key words." type="text" value="Test"
name="action" id="text1"/>

</fieldset>

[jQuery] Re: Advertising in jquery docs: normal?

Please be assured that I had nothing to do with the placement of that link (even though I'm a co-author of it).

And by "co-author of it" I meant "co-author of the book."

--Karl

[jQuery] Re: Advertising in jquery docs: normal?

Hi Alexandre,

Thanks for calling this to our attention. Actually, the page itself shouldn't be there. I just edited it to redirect to the proper location, http://docs.jquery.com/Attributes/removeClass

Please be assured that I had nothing to do with the placement of that link (even though I'm a co-author of it). In fact, I don't recommend that people buy the jQuery Reference Guide because it's out of date.

thanks again,

--Karl

____________
Karl Swedberg




On Feb 28, 2009, at 7:42 PM, Alexandre Plennevaux wrote:


Hi there,

Since the docs are based on a wiki, i wonder if this is intended or
not by the jquery team:  on this page, the links chapter contains an
incentive to buy a jquery book.
http://docs.jquery.com/Removeclass


see:

" For more details buy the jQuery Reference Guide here in this site
http://www.packtpub.com/jQuery/book/mid/1004077zztq0 "


Not that it's out of context,, irrelevant or overly visually invasive,
but is this not  a hidden advertisement? Is this allowed?


Alexandre

[jQuery] Re: forcing ajax request to stop

sure, the $.ajax method returns the xhr object, and you can call the
abort method of it. Something like follows:

var xhr = $.ajax(...);
xhr.abort();

Regards,
svpino.


On Feb 23, 1:12 pm, Adam <epne...@gmail.com> wrote:
> Hey, I'm looking for a way to force some known running ajax requests
> to stop before initiating another call..
>
> I'm using the jQuery.ajax global events to monitor the active
> requests.. but in the jQuery docs, i was unable to find a method of
> forcing a processing request to actually stop...
>
> For example, in this case, if someone starts a "search" request.. but
> then changes there mind and wants to submit different request, I want
> the currently processing "search" request to be forced to stop before
> allowing the second search to be sent to my back end....
>
> The only way i can see this happening, is to build into my backend
> request a method of recieving a "stop" message, and then abborting the
> back end call, thus forcing the request to stop..
>
> Does anyone know of a way of doing this with just jQuery or perhaps
> the XHR object?

[jQuery] Re: $('#foo p') or $('p', $('#foo'))

You maybe know this, but there's a great website that compares
compatibility in different popular browsers:

http://www.quirksmode.org/dom/w3c_core.html

I've noticed lately to the "querySelectorAll" method. Looks
promising :)


more to see here:
http://www.quirksmode.org/compatibility.html


--
Dor

On Feb 26, 4:42 pm, John Resig <jere...@gmail.com> wrote:
> > The benchmark is getElementById().getElementsByTagName() - why not
> > inlcude that in the test?
>
> But it's not that simple (it never is). That code doesn't take into
> account browsers, like IE, returning element that have a name equal to
> the ID, not does it take into account the element (with the ID) not
> existing, nor does it return a static list of elements - it returns a
> live NodeSet (which is a constant source of misconceptions for
> developers).
>
> If you want to play the cross-browser roulette, make sure you go all the way in.
>
> --John

[jQuery] Re: jQuery tabs problem with language

Please upload a test file with all related content.

Hebrew:
בבקשה תעלה קובץ XHTML לבדיקה עם כל התוכן הרלונטי.
זה כולל את קובץ ה-jQuery בגירסא המתאימה שלו, הקטע כולו של התגים
שקשורים ל-Tabs וכן קוד JS מתאים...
העלאה של 2 קבצים נפרדים שכל אחד מהם מכיל טקסט בשפה אחרת (אחד עברית
ואחד אנגלית) - יעזור.

On Feb 28, 5:30 pm, hitautodestruct <yotam.pr...@gmail.com> wrote:
> Yeah, noticed that after the post.
> But I fixed that and it's not the problem.
> Any other clue as to why it's not working?
>
> On Feb 27, 10:19 pm, Klaus Hartl <klaus.ha...@googlemail.com> wrote:
>
> > You have a "#" too much in your panel ids... Should read:
>
> > <div id="tabs-1"> ...
>
> > --Klaus
>
> > On 27 Feb., 17:35, hitautodestruct <yotam.pr...@gmail.com> wrote:
>
> > > Hi,
>
> > > I have a problem implementing jQuery tabs using hebrew content in the
> > > li and div elements.
> > > I get the error "jQuery UI Tabs: Mismatching fragment identifier" when
> > > clicking on the tabs.
>
> > > Everything works perfect when the text is english but when I have
> > > hebrew in it it returns the above error.
>
> > > I am using jQuery 1.2.6 and UI version 1.5.3.
> > > Code:
> > >                                                         <div id="tabHolder">
> > >                                                                 <ul>
> > >                                                                         <li><a href="#tabs-1">דוגמא</a></li>
> > >                                                                         <li><a href="#tabs-2">דוג</a></li>
> > >                                                                         <li><a href="#tabs-3">דגמא</a></li>
> > >                                                                         <li><a href="#tabs-4">עוד דוגמא</a></li>
> > >                                                                         <li><a href="#tabs-5">דוגמא דוגמא</a></li>
> > >                                                                 </ul>
> > >                                                                 <div id="#tabs-1" class="">                                                                   עברית
> > >                                                                 </div>
> > >                                                                 <div id="#tabs-2">
> > >                                                                                                                                                 עברית
> > >                                                                 </div>
> > >                                                                 <div id="#tabs-3">                                                                      עברית
> > >                                                                 </div>
> > >                                                                 <div id="#tabs-4">
> > >                                                                                                                                                 עברית
> > >                                                                 </div>
> > >                                                                 <div id="#tabs-5">
> > >                                                                         עברית
> > >                                                                 </div>
>
> > > Is there a tweak or some option to internationalize the tabs?
> > > I am using UTF-8 encoding on the page.
>
> > > Thanks

[jQuery] Advertising in jquery docs: normal?

Hi there,

Since the docs are based on a wiki, i wonder if this is intended or
not by the jquery team: on this page, the links chapter contains an
incentive to buy a jquery book.
http://docs.jquery.com/Removeclass


see:

" For more details buy the jQuery Reference Guide here in this site
http://www.packtpub.com/jQuery/book/mid/1004077zztq0 "


Not that it's out of context,, irrelevant or overly visually invasive,
but is this not a hidden advertisement? Is this allowed?


Alexandre

[jQuery] Re: Form inside Form value

The different way would be to remove the nested form and place the
fields that were inside the nested form in the parent form. There are
ways to post only specific fields.

I don't see why this is necessary. Also, this messes up browser
functionality; when the nested form is submitted, it submits the
parent form instead.

-Trey

On Feb 28, 12:31 pm, Po01 <diogoapa...@gmail.com> wrote:
> Can you give me a different way?
> I cant believe its impossible to get the value of a field inside a
> form when both are inside another form.
> Thanks.
>
> On 27 fev, 18:34, tres <TresHug...@gmail.com> wrote:
>
>
>
> > Do it a different way.
>
> > On Feb 28, 6:20 am, Po01 <diogoapa...@gmail.com> wrote:
>
> > > Oh, and i know its not under "webstandarts" but i really need to get
> > > the value.
> > > Yes the email is the name of the label field.
>
> > > On 27 fev, 16:14, Po01 <diogoapa...@gmail.com> wrote:
>
> > > > Tried the $("form2 field").val(); but remember that form2 is a
> > > > variable, tried some stuff but it doesnt work.
> > > > Also tried $(Form2).find('input[name="email"]').get(0).val(); and..
> > > > cant get the value =(
>
> > > > On 27 fev, 06:43, saifullah hanif <saifullah...@gmail.com> wrote:
>
> > > > >http://tinyurl.com/cyecufhttp://tinyurl.com/ahvxzc
>
> > > > >http://tinyurl.com/8rwmkr
>
> > > > >http://tinyurl.com/7wbm8o
>
> > > > > On 2/27/09, Po01 <diogoapa...@gmail.com> wrote:
>
> > > > > > Hi, i have a HTML like that:
>
> > > > > > <form 1>
> > > > > > <form 2>
> > > > > > <field>
> > > > > > </form 2>
> > > > > > </form 1>
>
> > > > > > Supposing the field name is email, how can i get its value using
> > > > > > Javascript/JQuery?
> > > > > > I tried some stuff.. without success..
>
> > > > > > The form 2 name Im getting as a variable, like:
> > > > > > function values(id)
> > > > > > {
> > > > > > var ID = id;
> > > > > > var Form2 = "#form2_" + ID;
> > > > > > ...
> > > > > > }
>
> > > > > > So i need a code that use this Form2 to get the email field value
> > > > > > inside it.
> > > > > > Tried some stuff but dunno how to do that when Form2 is inside Form1.
>
> > > > > > Thanks.

comp.lang.c++ - 24 new messages in 10 topics - digest

comp.lang.c++
http://groups.google.com/group/comp.lang.c++?hl=en

comp.lang.c++@googlegroups.com

Today's topics:

* macro - 4 messages, 4 authors
http://groups.google.com/group/comp.lang.c++/t/84731ce3c14b7152?hl=en
* Free Shipping NFL jerseys 16USD NHL Jerseys 34USD at www.guoshijerseys.com
Paypal payment - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/e6a6092bc1cfc545?hl=en
* smart pointer with custom deconstruction? - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/eab403107607f6a4?hl=en
* networking libraries - 4 messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/956adbc777247eed?hl=en
* Pass by pointer - segmentation fault - 2 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/8599ee7e5e13f89a?hl=en
* small template problem - 4 messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/e314a2e29deb61eb?hl=en
* ALGORITHM - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/15dd5e0193a57f9f?hl=en
* Singletons / classes with only one member - 4 messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/05ca01b012ed3ee0?hl=en
* Accessing & Updating an STL list - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/484fb30bdd8b6c0b?hl=en
* std::sort causes segfault when sorting class arrays - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/67d1aa830ced63bb?hl=en

==============================================================================
TOPIC: macro
http://groups.google.com/group/comp.lang.c++/t/84731ce3c14b7152?hl=en
==============================================================================

== 1 of 4 ==
Date: Fri, Feb 27 2009 11:47 pm
From: "Fernando A. Gómez F."


Sam wrote:
> asmcad writes:
>
>> i'm using wxWidget and i saw same strange macro:
>>
>> # define WXDLLIMPEXP_CL
>>
>> class WXDLLIMPEXP_CL classname {
>> ....
>> ..
>>
>> why they do this? what does it mean? does anybody write code like
>> this?
>
> Some technically flawed operating systems may require usage of some
> non-standard keywords in order to define certain attributes of classes
> that must be specified in order to get the wanted results.
>
> Your library's configuration script will install the appropriate
> definition of this macro, when your library is installed on that
> particular operating system.
>

In Visual C++, you usually do something like this:

#ifdef MYDLL_EXPORTS
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)

[jQuery] submenu doesn't hide

url: bldd.nl/jsproblems/convertToJQuery.html

this part of my code doesn't seem to work

------------
alert($expandedSiblings.size());
if ($expandedSiblings.size() > 0) {
$expandedSiblings.slideUp(500, function(){
$heading.find('ul').slideDown(500);
});
}
----------------

an already opened submenu isn't closed???

regards

[jQuery] Cycle - IE6 (only) layout break w/ LI fix

I have been trying to figure out why, when I add Cycle to a page, the
#header displayed a 20px (approx) margin-bottom that wasn't specified
- but ONLY in Win/IE6. Tested by adding Cycle, checking on
Browsershots for IE6 (which always - W2K and XP - showed this problem)
and IE7 (which never showed this problem), removing Cycle (resulting
in no display problems), etc. HTML and CSS validate.

I saw nothing in #header that could cause this. I read about a float
bug w/IE6 and added position:relative, no change (Grasping at Straws
Department). I happened to notice the list items in the navigation UL
(last selector before /#header) had no spaces, and added a space after
each LI text.

Problem solved, afaik!

[jQuery] [validation] Changing class label on succes

Hey, my validation form works just fine but i've a problem with
changing the class at a successful validation.

My Code:
success: function(label) {
label.addClass('success').text("Ok!")
},
errorPlacement: function(error, element) {
error.appendTo( element.parent("td").next("td") );
},
highlight: function(element, errorClass) {
$(element.form).find("label[for=" + element.name + "]").addClass
(errorClass);
},
unhighlight: function(element, errorClass) {
$(element.form).find("label[for=" + element.name + "]").removeClass
(errorClass);
}

I want that the class "error" will be removed and that the class
"success" will be added. But, when I do this, The script doesn't
recognize the 'label'-element anymore. How can I fix this properly?
For now, I changed the following:
errors: function() {
return $( this.settings.errorElement + "." +
this.settings.errorClass, this.errorContext );
},
into:
errors: function() {
return $( this.settings.errorElement, this.errorContext );
},

Greetings,
Tim

[jQuery] Re: alternate color row starting from a point

Two other ways:

$('tr.className + tr').each(function(){
var nxt = $(this), i=0;
while (nxt.length){
nxt.css('backgroundColor', i%2 ? 'white' : 'red');
nxt = n.next(':not(.className)');
i++;
}
});

Or this (I prefer the first, this one is probably slower):

$('tr.className + tr').each(function(){
var t = $(this), nxt = t;
while (nxt.length){
nxt = nxt.next(':not(.className)');
t = t.add(next);
}
t.filter(':even').css('color','red');
t.filter(:odd').css('color', 'white');
});

cheers,
- ricardo

On Feb 28, 12:06 am, Josh Powell <seas...@gmail.com> wrote:
> hmmm, tough one, it was fun.
>
> $(function() {
>     var color = '';
>     $('#everyother tr').each(function() {
>         if( $(this).hasClass('className') ) {
>             color = 'red';
>         } else if (color === 'red') {
>             $(this).css({'background-color': 'red'});
>             color = '';
>         } else {
>             color = 'red';
>         }
>     });
>
>     <table id="everyother">
> <tr class="className"><td>className</td></tr>
> <tr><td>1</td></tr>
> <tr><td>1</td></tr>
> <tr class="className"></><td>className</td></tr>
> <tr><td>1</td></tr>
> <tr><td>1</td></tr>
> <tr><td>1</td></tr>
> <tr class="className"><td>className</td></tr>
> <tr><td>1</td></tr>
> <tr><td>1</td></tr>
> </table>
>
> On Feb 27, 9:03 am, Magritte <marco.oliva...@gmail.com> wrote:
>
> > Ok, it work, but I another trouble.
>
> > the code now become:
> > $('tr:not(.className):odd').css({'background':'red'});
>
> > because I would like to color row alternatively.
> > The problem is that I would like that the alternativy start alway with
> > red.(first '<tr>' after every '<tr class="className"></></tr>' red,
> > then 'white', then red,....)
>
> > With this code it doesn't happen.
>
> > Thanks
>
> > On 27 Feb, 13:17, Thomas Jaggi <thomas.ja...@gmail.com> wrote:
>
> > > This should do it:
> > > $('tr:not(.className)').css({'background':'red'});

[jQuery] Superfish submenu items not clickable IE7

Well, this is giving me fits.

Superfish does the job in every browser but the miserable IE7, where
the submenu items are not clickable.

See the bottom-most (dark-brown) menu here called "In Our Classrooms"
http://ivanhoeschool.com

I have tried increasing the z-index to 1000 in all the relevant
classes, but that has no effect.

I read one jQuery list post that seemed to indicate something might be
going on with the .bind function but unfortunately, I know nothing
about jQuery, and didn't want to get in there and damage things
further.

Hoping that someone familiar with the Superfish module for Joomla 1.5
can tell me what's going on.

mack
los angeles

[jQuery] click thumbnail show large image in separate div, slide up image description in another div

Situation.

I have several thumbnails next to a div with id of 'image holder'. Under
that is another div with id of 'msg_body'. image_holder already shows first
thumbnail's large view image and msg_body already shows first thumbnails
description on page load.

I want to be able to click next thumbnail and have that large image fade in
the img-holder replacing previous and have new description slide up
replacing previous msg_body and so on with each thumbnail click. I should be
able to just click around on thumbnails and have large image show as well
that images's description slide up and show.

I have managed to get the img change function on thumbnail click to work and
the msg_body slide to work on thumbnail click and I've even managed to get
the image to change and the text to slide up on first click but I can't get
them to work together correctly at the same time.

I am relatively new to jquery and after four days of trying it every which
way -- I am wondering if someone can help.

here is one of the thumbnails

it is a list item with class of "largeImage" . The href is the path to large
image and the image source is the path to thumbnail.


//This is the msg_body slide up

$(document).ready(function(){



//hide the all div except first one
$('.msg_body:not(:first)').hide();
//when the anchor is clicked content gets slided
$("a.largeImage").click(function()
{

$('.msg_body').slideUp("slow");
$($(this).attr("href")).slideDown("slow");
});

});

This is the img change

$(function() {

$("#section_select a").click(function()
{

var largePath = $(this).attr("href");
var largeAlt = $(this).attr("title");
$("#largeImg").attr({ src: largePath, alt: largeAlt });
$("h2 em").html(" (" + largeAlt + ")");

return false;



});
});

--
View this message in context: http://www.nabble.com/click-thumbnail-show-large-image-in-separate-div%2C-slide-up-image-description-in-another-div-tp22265586s27240p22265586.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

[jQuery] click thumbnail show large image in separate div, slide up image description in another div

Situation.

I have several thumbnails next to a div with id of 'image holder'. Under
that is another div with id of 'msg_body'. image_holder already shows first
thumbnail's large view image and msg_body already shows first thumbnails
description on page load.

I want to be able to click next thumbnail and have that large image fade in
the img-holder replacing previous and have new description slide up
replacing previous msg_body and so on with each thumbnail click. I should be
able to just click around on thumbnails and have large image show as well
that images's description slide up and show.

I have managed to get the img change function on thumbnail click to work and
the msg_body slide to work on thumbnail click and I've even managed to get
the image to change and the text to slide up on first click but I can't get
them to work together correctly at the same time.

I am relatively new to jquery and after four days of trying it every which
way -- I am wondering if someone can help.

here is one of the thumbnails

<li> large image path here image thumb path here </li>

//This is the msg_body slide up

$(document).ready(function(){



//hide the all div except first one
$('.msg_body:not(:first)').hide();
//when the anchor is clicked content gets slided
$("a.largeImage").click(function()
{

$('.msg_body').slideUp("slow");
$($(this).attr("href")).slideDown("slow");
});

});

This is the img change

$(function() {

$("#section_select a").click(function()
{

var largePath = $(this).attr("href");
var largeAlt = $(this).attr("title");
$("#largeImg").attr({ src: largePath, alt: largeAlt });
$("h2 em").html(" (" + largeAlt + ")");

return false;



});
});

--
View this message in context: http://www.nabble.com/click-thumbnail-show-large-image-in-separate-div%2C-slide-up-image-description-in-another-div-tp22265586s27240p22265586.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

[jQuery] Re: problems extracting links and redirecting to function

you rock man, thanks that works. amazing stuff, I've no idea why that
would work
but apparently because of event bubbling, I'll read up on that

many thanks again


On 28 Feb, 18:52, Karl Swedberg <k...@englishrules.com> wrote:
> Ah, in that case you might want to use the .live() binding:
>
> $( "#wiki_content a" ).live('click', function(event) {
>    event.preventDefault();
>    var link = $(this).text();
>    searchDelay( link );
>
> });
>
> --Karl
>
> ____________
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Feb 28, 2009, at 11:35 AM, hybris77 wrote:
>
>
>
> > thanks for the feedback, that is a much better solution, however
> > I don't seem to be getting hold of the <a> tags that im after, the
> > problem might be the fact that the div containing the tags is not yet
> > populated when the jquery function to get them runs... but im not sure
>
> > the div #wiki_content is populated using a AJAX call just before
> > the code im posting here, it contains a set of <p> tags with <a>
> > tags in them but pointing at the div itself will get hold of the
> > a tags right?
>
> > On 28 Feb, 17:27, Karl Swedberg <k...@englishrules.com> wrote:
> >> I think it would be a lot simpler to rely on jQuery's implicit
> >> iteration:
>
> >> $( "#wiki_content a" ).click(function(event) {
> >>    event.preventDefault();
> >>    var link = $(this).text();
> >>    searchDelay( link );
>
> >> });
>
> >> --Karl
>
> >> ____________
> >> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> >> On Feb 28, 2009, at 10:50 AM, hybris77 wrote:
>
> >>> can anyone please see waht's wrong with this
>
> >>> I want to get all <a> tags in the div #wiki_content and get the text
> >>> from
> >>> it and send into a function called searchDelay... im not getting as
> >>> far as
> >>> jumping into the $.each loop so not sure waht's wrong
>
> >>> var links = $( "#wiki_content a" );
>
> >>>    $.each( links, function( event ){
> >>>            $(this).click(function( event ){
> >>>            event.preventDefault();
> >>>            var link = $(this).text();
> >>>            searchDelay( link );
> >>>            });
> >>>    });
>
> >>> many thanks

[jQuery] Re: Multiple inclusions of jquery possible?!?

Thanks! I'm not sure we can use that, because there are a couple of
complications.

For starters both jquery versions are using plugins, and you seem to
be using the "extreme" version of noConflict(), which, according to
the jq docs:

"NOTE: It's very likely that plugins won't work after this particular
method has been called."

[jQuery] Re: $('#foo p') or $('p', $('#foo'))

For anyone interested, here is the updated set of 'tests' for the test
page I posted previously. This is the test-set John is currently
using:

// Test # 1
start = new Date();
$Test = $("#div"+ myDiv +" p");
end = new Date();
a_Selectors.push('$("#div'+ myDiv +' p")');
a_Times.push(end - start);

// Test # 2
start = new Date();
$Test = $("p", "#div"+ myDiv);
end = new Date();
a_Selectors.push('$("p", "#div'+ myDiv +'")');
a_Times.push(end - start);

// Test # 3
start = new Date();
$Test = $("#div"+ myDiv).find("p");
end = new Date();
a_Selectors.push('$("#div'+ myDiv +'").find("p")');
a_Times.push(end - start);

// Test # 4
start = new Date();
$Test = $("#div"+ myDiv +" > p");
end = new Date();
a_Selectors.push('$("#div'+ myDiv +' > p")');
a_Times.push(end - start);

// Test # 5
start = new Date();
$Test = $("#div"+ myDiv).children("p");
end = new Date();
a_Selectors.push('$("#div'+ myDiv +'").children("p")');
a_Times.push(end - start);

// Test # 6
start = new Date();
$Test = $($("#div"+ myDiv)[0].childNodes).filter("p");
end = new Date();
a_Selectors.push('$( $("#div'+ myDiv +'")[0].childNodes ).filter
("p")');
a_Times.push(end - start);

If you created your own test page, just copy-n-paste these tests into
it.

NOTE that setting: 'c_divs=1000' and 'c_paras=500' (as John is using)
makes the page very slow to load because it has to generate all these
elements. So for quick tests, reduce these numbers to 100 each. But if
you find something interesting, try cranking the numbers up again - it
magnifies the speed differences between the tests.

/Kevin

On Feb 25, 6:48 pm, RobG <rg...@iinet.net.au> wrote:
> On Feb 26, 11:22 am, John Resig <jere...@gmail.com> wrote:
>
> The benchmark is getElementById().getElementsByTagName() - why not
> inlcude that in the test?  Add the following below test 3:
>
> // Test # 4
> start = new Date();
> $Test = document.getElementById('div' +
>             myDiv).getElementsByTagName('p');
> end = new Date();
> a_Selectors.push('getEBI().getEBTName()');
> a_Times.push(end - start);
>
> --
> Rob

[jQuery] Re: Tell if its the last item on a .each?

an example

var arr = new Array("a", "b", "c", "d");
$.each(arr, function(idx) {
if (idx == (arr.length - 1)) {
// at last item
}
});

On Feb 28, 12:49 pm, Toaster <mr.toas...@gmail.com> wrote:
> Hey
>
> How do I tell if the item on a .each is the last one? For example,
> lets say I want to add a comma after every item and not the last one,
> how would I do that?
>
> Thanks in advance.

[jQuery] Re: problems extracting links and redirecting to function

Ah, in that case you might want to use the .live() binding:

$( "#wiki_content a" ).live('click', function(event) {
  event.preventDefault();
  var link = $(this).text();
  searchDelay( link );  
});


--Karl

____________
Karl Swedberg




On Feb 28, 2009, at 11:35 AM, hybris77 wrote:


thanks for the feedback, that is a much better solution, however
I don't seem to be getting hold of the <a> tags that im after, the
problem might be the fact that the div containing the tags is not yet
populated when the jquery function to get them runs... but im not sure

the div #wiki_content is populated using a AJAX call just before
the code im posting here, it contains a set of <p> tags with <a>
tags in them but pointing at the div itself will get hold of the
a tags right?


On 28 Feb, 17:27, Karl Swedberg <k...@englishrules.com> wrote:
I think it would be a lot simpler to rely on jQuery's implicit  
iteration:

$( "#wiki_content a" ).click(function(event) {
   event.preventDefault();
   var link = $(this).text();
   searchDelay( link );

});

--Karl

____________
Karl Swedbergwww.englishrules.comwww.learningjquery.com

On Feb 28, 2009, at 10:50 AM, hybris77 wrote:



can anyone please see waht's wrong with this

I want to get all <a> tags in the div #wiki_content and get the text
from
it and send into a function called searchDelay... im not getting as
far as
jumping into the $.each loop so not sure waht's wrong

var links = $( "#wiki_content a" );

   $.each( links, function( event ){
           $(this).click(function( event ){
           event.preventDefault();
           var link = $(this).text();
           searchDelay( link );
           });
   });

many thanks

[jQuery] Tell if its the last item on a .each?

Hey

How do I tell if the item on a .each is the last one? For example,
lets say I want to add a comma after every item and not the last one,
how would I do that?

Thanks in advance.

[jQuery] Re: Form Validation

Hi Gelegrodan -

Thank you for your response.

I'm trying the jquery validation plugin and also using post
http://groups.google.com/group/jquery-en/browse_thread/thread/6411a46d271c1ce4#

as a reference, but I still can't make it work.

On Feb 27, 5:34 pm, Gelegrodan <GeleGro...@gmail.com> wrote:
> Use the jquery validation plugin!http://bassistance.de/jquery-plugins/jquery-plugin-validation/
>
> On Feb 27, 9:27 pm, ml2009 <mcl...@systemsview.biz> wrote:
>
>
>
> > I have just started using jQuery and wonder if you could help me
> > please.
>
> > I am working on a form which contains a field to enter multi-email
> > addresses.  How could I validate this field using jQuery?
>
> > This is what I would do if I were not using the jQuery library
>
> > function multiEmail(my_emails) {
> >         var email = my_emails.split(';');
> >         for (var i = 0; i < email.length; i++) {
> >         if (!validateEmail(email[i], "Your email is invalid.", 0)) {
> >         return false;
> >         }
> >         }
> >         return true;
> >         }
> > function validateEmail(email, msg) {....}
>
> > How could I customize the function above to go inside the addMethod
> > below?
>
> > jQuery.validator.addMethod("multiEmail", function(...) {
>
> > }- Hide quoted text -
>
> - Show quoted text -

[jQuery] jquery validation question: validate a single form element onsubmit

I'm using the validate plugin, and am having a problem with simple one element forms.  I have a single select list and a submit button.  If the select list is empty, the validation prompts that it is required.  When you choose an option, and click Submit, it validates and removes the required message, but then you have to click Submit a second time to actually submit the form... what would I need to do to have it validate the select onchange, so the submit fires the form submit?

validation code:
<script language="Javascript">/* validation for radio button forms */
// wait for the DOM to be loaded 
$(document).ready(function() {
   // validate form on keyup and submit
var validator = $('#select').validate({
      rules: {
field: "required"
      },
      messages: {
field: "Please select a value."
      }
   });
});
</script>

Any advice is appreciated.

[jQuery] How to traverse HTML ?/??????

**************************

The leading business search engine and business directory
designed to help its users find the companies, products,
services, and information they need to ...

***************************

_______________________________

http://www.coherentis.webs.com

_______________________________

Friday, February 27, 2009

[jQuery] Re: function $.ajax return true/false ?

Yeah that seems to work, if i have async: false ;)
Thanks!

On Feb 27, 8:06 pm, James <james.gp....@gmail.com> wrote:
> I think it's a function scope thing.
> How about something like:
>
> function pnrexists(a){
> var returnVal = false;
> $.ajax({
> async: true,
> url: '/inc/chkusr.php?q=p',
> type: 'POST',
> dataType: 'html',
> data: {'pnr': a},
> timeout: 2000,
> success: function(data) {
> if(data==1){
> alert('true');
> returnVal = true;
> }else{
> returnVal = false;
> }
> }
> });
> return returnVal;
>
> }
>
> On Feb 27, 9:04 am, James <james.gp....@gmail.com> wrote:
>
> > Oops, I just read that you did try 'false'..
>
> > On Feb 27, 9:03 am, James <james.gp....@gmail.com> wrote:
>
> > > I'm sorry, I mean 'async: false'! Try that. :)
>
> > > On Feb 27, 8:54 am, Gelegrodan <GeleGro...@gmail.com> wrote:
>
> > > > Hello!
> > > > Thanks you your answer, but it seems like it didnt help!
>
> > > > function pnrexists(a){
> > > > $.ajax({
> > > > async: true,
> > > > url: '/inc/chkusr.php?q=p',
> > > > type: 'POST',
> > > > dataType: 'html',
> > > > data: {'pnr': a},
> > > > timeout: 2000,
> > > > success: function(data) {
> > > > if(data==1){
> > > > alert('true');
> > > > return true;
> > > > }else{
> > > > return false;
> > > > }
> > > > }
> > > > });
>
> > > > }
>
> > > > $.validator.addMethod("pnrcheck", function(ph, element) {
> > > > if(persnr(ph)) {
> > > > alert('1');
> > > > if(pnrexists(ph)) {
> > > > alert('2');
> > > > I see:
> > > > alert 1 and alert true
>
> > > > setting the async to false dont seems to help either!
> > > > Any idea?
>
> > > > On Feb 27, 7:39 pm, James <james.gp....@gmail.com> wrote:
>
> > > > > The issue here is that AJAX is asynchronous. The the moment you're
> > > > > checking pnrexists(ph), it'll execute the AJAX but nothing is returned
> > > > > "at that moment" (which means it is not-true, so the if-statement
> > > > > fails). Then a few milliseconds later, your AJAX response has
> > > > > returned, but the code is way passed the if-statement by then already.
> > > > > Try adding the 'async: true' to the $.ajax() option. This tells the
> > > > > rest if your code to wait for the AJAX response before continuing.
>
> > > > > On Feb 27, 8:00 am, Gelegrodan <GeleGro...@gmail.com> wrote:
>
> > > > > > Hello
> > > > > > I have the following code:
>
> > > > > > function pnrexists(a){
> > > > > > $.ajax({
> > > > > > url: '/inc/chkusr.php?q=p',
> > > > > > type: 'POST',
> > > > > > dataType: 'html',
> > > > > > data: {'pnr': a},
> > > > > > timeout: 2000,
> > > > > > success: function(data) {
> > > > > > if(data==1){
> > > > > > alert('true');
> > > > > > return true;
> > > > > > }else{
> > > > > > alert('false');
> > > > > > return false;
> > > > > > }
> > > > > > },
> > > > > > });
>
> > > > > > }
>
> > > > > > the code above is triggered by:
>
> > > > > > $.validator.addMethod("pnrcheck", function(ph, element) {
> > > > > > alert('1');
> > > > > > if(persnr(ph)) {
> > > > > > alert('2');
> > > > > > if(pnrexists(ph)) {
> > > > > > alert('3');
> > > > > > the code continues..but noting to show...
>
> > > > > > The problem is: I see:
> > > > > > alert 1
> > > > > > alert 2
> > > > > > alert true
> > > > > > but NOT alert 3?? Why?