[jQuery] Re: Combining Selectors

2009-04-05 Thread Nic Hubbard

This worked!  Thank you!

On Apr 5, 4:06 pm, "Michael Geary"  wrote:
> To help troubleshoot, take jQuery out of the picture and replace your alert
> with:
>
> alert( this + " input[type='submit']" );
>
> That will make it clear what the problem is.
>
> Since concatenating "this" to a string doesn't work, how do you fix it? Use
> the second argument to the $ function:
>
> $( selector, context )
>
> Like this:
>
> alert( $( " input[type='submit']", this ).attr('id') );
>
> -Mike
>
> > From: Nic Hubbard
>
> > I am confused why the following is returning undefined:
>
> > alert($(this + " input[type='submit']").attr('id'));
>
> > This is within the context of a plugin that I built.  
> > Removing the this makes it correctly find the input, why I
> > want to narrow the scope.


[jQuery] Re: Combining Selectors

2009-04-05 Thread Michael Geary

To help troubleshoot, take jQuery out of the picture and replace your alert
with:

alert( this + " input[type='submit']" );

That will make it clear what the problem is.

Since concatenating "this" to a string doesn't work, how do you fix it? Use
the second argument to the $ function:

$( selector, context )

Like this:

alert( $( " input[type='submit']", this ).attr('id') );

-Mike

> From: Nic Hubbard
> 
> I am confused why the following is returning undefined:
> 
> alert($(this + " input[type='submit']").attr('id'));
> 
> This is within the context of a plugin that I built.  
> Removing the this makes it correctly find the input, why I 
> want to narrow the scope.
> 



[jQuery] Re: Combining Selectors

2009-04-05 Thread Mauricio (Maujor) Samy Silva



De: "Nic Hubbard" 

I am confused why the following is returning undefined:

alert($(this + " input[type='submit']").attr('id'));


Try the following:
Get rid of the blank space  before input.
from: ... " input[type='submit'] ...
to: ... "input[type='submit'] ...
Regards,
Maurício 



[jQuery] Re: Combining selectors

2008-10-23 Thread nguyenq

All of them work. Thank you all.

On Oct 22, 6:35 pm, ricardobeat <[EMAIL PROTECTED]> wrote:
> That should work, but it's worth noting that the '@' in front of
> attribute names has been deprecated.
>
> $('input[type=button],input[type=submit],input[type=reset]')
>
> jQuery also has pseudo-selectors for these elements:
>
> $(':button,:submit,:reset')
>
> []s
> - ricardo
>
> On Oct 22, 6:25 pm, "Mauricio \(Maujor\) Samy Silva"
>
> <[EMAIL PROTECTED]> wrote:
> > Try:
> > $("[EMAIL PROTECTED]'button'], [EMAIL PROTECTED]'submit'],
> > [EMAIL PROTECTED]'reset']").addClass("button");
>
> > See:http://docs.jquery.com/Selectors/multiple#selector1selector2selectorN
>
> > Mauricio
> > -
>
> > > I need help in this compound selector problem. I have the following
> > > jQuery statements, which are working:
>
> > >    $("[EMAIL PROTECTED]'button']").addClass("button");
> > >    $("[EMAIL PROTECTED]'submit']").addClass("button");
> > >    $("[EMAIL PROTECTED]'reset']").addClass("button");


[jQuery] Re: Combining selectors

2008-10-22 Thread ricardobeat

That should work, but it's worth noting that the '@' in front of
attribute names has been deprecated.

$('input[type=button],input[type=submit],input[type=reset]')

jQuery also has pseudo-selectors for these elements:

$(':button,:submit,:reset')

[]s
- ricardo

On Oct 22, 6:25 pm, "Mauricio \(Maujor\) Samy Silva"
<[EMAIL PROTECTED]> wrote:
> Try:
> $("[EMAIL PROTECTED]'button'], [EMAIL PROTECTED]'submit'],
> [EMAIL PROTECTED]'reset']").addClass("button");
>
> See:http://docs.jquery.com/Selectors/multiple#selector1selector2selectorN
>
> Mauricio
> -
>
> > I need help in this compound selector problem. I have the following
> > jQuery statements, which are working:
>
> >    $("[EMAIL PROTECTED]'button']").addClass("button");
> >    $("[EMAIL PROTECTED]'submit']").addClass("button");
> >    $("[EMAIL PROTECTED]'reset']").addClass("button");


[jQuery] Re: Combining selectors

2008-10-22 Thread Smith, Allex

Ignore what I just said... according to the docs it will only match if
all the attributes are the same, not based on an "or".

AllexS

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of nguyenq
Sent: Wednesday, October 22, 2008 12:41 PM
To: jQuery (English)
Subject: [jQuery] Combining selectors


I need help in this compound selector problem. I have the following
jQuery statements, which are working:

$("[EMAIL PROTECTED]'button']").addClass("button");
$("[EMAIL PROTECTED]'submit']").addClass("button");
$("[EMAIL PROTECTED]'reset']").addClass("button");

I want to combine them into a single statement, such as:

$("[EMAIL PROTECTED]'button' or @type='submit' or
@type='reset']").addClass("button");

or

$("[EMAIL PROTECTED]'button'] or [EMAIL PROTECTED]'submit'] or
[EMAIL PROTECTED]'reset']").addClass("button");

similar to the Boolean OR that XPATH expresssion allows, but it does
not work. What is the proper syntax, if the combining is possible?


[jQuery] Re: Combining selectors

2008-10-22 Thread Mauricio (Maujor) Samy Silva


Try:
$("[EMAIL PROTECTED]'button'], [EMAIL PROTECTED]'submit'], 
[EMAIL PROTECTED]'reset']").addClass("button");


See: http://docs.jquery.com/Selectors/multiple#selector1selector2selectorN

Mauricio
-

I need help in this compound selector problem. I have the following
jQuery statements, which are working:

   $("[EMAIL PROTECTED]'button']").addClass("button");
   $("[EMAIL PROTECTED]'submit']").addClass("button");
   $("[EMAIL PROTECTED]'reset']").addClass("button");




[jQuery] Re: Combining selectors

2008-10-22 Thread Smith, Allex

http://docs.jquery.com/Selectors/attributeMultiple#attributeFilter1attri
buteFilter2attributeFilterN

$("input[type='button'][type='submit'][type='reset'].addClass("button");

Should work I believe. Untested.

AllexS

Hope this helps

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of nguyenq
Sent: Wednesday, October 22, 2008 12:41 PM
To: jQuery (English)
Subject: [jQuery] Combining selectors


I need help in this compound selector problem. I have the following
jQuery statements, which are working:

$("[EMAIL PROTECTED]'button']").addClass("button");
$("[EMAIL PROTECTED]'submit']").addClass("button");
$("[EMAIL PROTECTED]'reset']").addClass("button");

I want to combine them into a single statement, such as:

$("[EMAIL PROTECTED]'button' or @type='submit' or
@type='reset']").addClass("button");

or

$("[EMAIL PROTECTED]'button'] or [EMAIL PROTECTED]'submit'] or
[EMAIL PROTECTED]'reset']").addClass("button");

similar to the Boolean OR that XPATH expresssion allows, but it does
not work. What is the proper syntax, if the combining is possible?