[jQuery] Re: Question about the context attribute of a jQuery call

2007-05-24 Thread Rob Desbois

Just to add my own input here - I would prefix the IDs with whatever was
most appropriate to make them unique to each form:

form id=redlineSelect
   select id=redlineMake
   some options here
   /select
select id=redlineModel
   some options here
   /select
/form

$(#redlineMake).click(...);

--rob


On 5/23/07, Andy Matthews [EMAIL PROTECTED] wrote:



Right...

I admit it's not the best, but I wanted to see about that possibility so
as
to change as little code as possible.

I ended up giving each select it's own unique ID and of course that works
just fine.

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Josh Nathanson
Sent: Wednesday, May 23, 2007 2:26 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Question about the context attribute of a jQuery
call


The OP has a case where there are two forms, each with its own ID,
however,
the elements of each form are the same so there are duplicate ID's.

Perhaps this is not the best design pattern, and class or name could be
used
for selection rather than IDs.  Or, set it up so the IDs are not
duplicated.

-- Josh


- Original Message -
From: Daemach [EMAIL PROTECTED]
To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, May 23, 2007 11:46 AM
Subject: [jQuery] Re: Question about the context attribute of a jQuery
call



 I think you can use a selector in a context attribute, but there isn't
 much point in this situation.  If all of your ID's are unique (and
 they should be), $('#make') is enough.  You don't need a context.
 When you use the #, it's the same as doing document.getElementByID();

 On May 23, 11:19 am, Sean Catchpole [EMAIL PROTECTED]
 wrote:
  $('#make','#redlineSelect').click( do something here)

 It's invalid to have a string as the second parameter to jQuery. Try
 this instead:
 $(#redlineSelect #make).click(...);

 ~Sean







--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Question about the context attribute of a jQuery call

2007-05-23 Thread Andy Matthews
Looks like I answered my own question. Doesn't appear that this is possible.

  _  

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andy Matthews
Sent: Wednesday, May 23, 2007 1:01 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Question about the context attribute of a jQuery call


Assume I have two form elements, both of which are identical in every way
(contents and all) except for their IDs. One named redlineSelect, and the
other named inventorySelect.
 
form id=redlineSelect or inventorySelect
select id=make
some options here
/select
select id=model
some options here
/select
/form
 
if I do a click function like so:
 
$('#make','#redlineSelect').click( do something here)
 
will that only apply to the make dropdown inside the redlineSelect form tag?
 

 
Andy Matthews
Senior Coldfusion Developer

Office:  877.707.5467 x747
Direct:  615.627.9747
Fax:  615.467.6249
[EMAIL PROTECTED]
www.dealerskins.com http://www.dealerskins.com/ 
 
att59b62.bmp

[jQuery] Re: Question about the context attribute of a jQuery call

2007-05-23 Thread Benjamin Sterling

I would say yes.


--
Benjamin Sterling
http://www.KenzoMedia.com
http://www.KenzoHosting.com


[jQuery] Re: Question about the context attribute of a jQuery call

2007-05-23 Thread Daemach

I think you can use a selector in a context attribute, but there isn't
much point in this situation.  If all of your ID's are unique (and
they should be), $('#make') is enough.  You don't need a context.
When you use the #, it's the same as doing document.getElementByID();

On May 23, 11:19 am, Sean Catchpole [EMAIL PROTECTED]
wrote:
  $('#make','#redlineSelect').click( do something here)

 It's invalid to have a string as the second parameter to jQuery. Try
 this instead:
 $(#redlineSelect #make).click(...);

 ~Sean



[jQuery] Re: Question about the context attribute of a jQuery call

2007-05-23 Thread Josh Nathanson


The OP has a case where there are two forms, each with its own ID, however, 
the elements of each form are the same so there are duplicate ID's.


Perhaps this is not the best design pattern, and class or name could be used 
for selection rather than IDs.  Or, set it up so the IDs are not duplicated.


-- Josh


- Original Message - 
From: Daemach [EMAIL PROTECTED]

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, May 23, 2007 11:46 AM
Subject: [jQuery] Re: Question about the context attribute of a jQuery call




I think you can use a selector in a context attribute, but there isn't
much point in this situation.  If all of your ID's are unique (and
they should be), $('#make') is enough.  You don't need a context.
When you use the #, it's the same as doing document.getElementByID();

On May 23, 11:19 am, Sean Catchpole [EMAIL PROTECTED]
wrote:

 $('#make','#redlineSelect').click( do something here)

It's invalid to have a string as the second parameter to jQuery. Try
this instead:
$(#redlineSelect #make).click(...);

~Sean






[jQuery] Re: Question about the context attribute of a jQuery call

2007-05-23 Thread Daemach

I think he said two form elements, both of which are identical in
every way (contents and all) except for their IDs.

That being said, if there were 2 forms, duplicating name attributes
would be fine since you would use the parent form's context to get to
them.  ID's should always be absolutely unique.

http://www.w3.org/TR/html401/struct/global.html#h-7.5.2

On May 23, 12:26 pm, Josh Nathanson [EMAIL PROTECTED]
wrote:
 The OP has a case where there are two forms, each with its own ID, however,
 the elements of each form are the same so there are duplicate ID's.

 Perhaps this is not the best design pattern, and class or name could be used
 for selection rather than IDs.  Or, set it up so the IDs are not duplicated.

 -- Josh

 - Original Message -
 From: Daemach [EMAIL PROTECTED]
 To: jQuery (English) jquery-en@googlegroups.com
 Sent: Wednesday, May 23, 2007 11:46 AM
 Subject: [jQuery] Re: Question about the context attribute of a jQuery call

  I think you can use a selector in a context attribute, but there isn't
  much point in this situation.  If all of your ID's are unique (and
  they should be), $('#make') is enough.  You don't need a context.
  When you use the #, it's the same as doing document.getElementByID();

  On May 23, 11:19 am, Sean Catchpole [EMAIL PROTECTED]
  wrote:
   $('#make','#redlineSelect').click( do something here)

  It's invalid to have a string as the second parameter to jQuery. Try
  this instead:
  $(#redlineSelect #make).click(...);

  ~Sean



[jQuery] Re: Question about the context attribute of a jQuery call

2007-05-23 Thread Andy Matthews

Right...

I admit it's not the best, but I wanted to see about that possibility so as
to change as little code as possible.

I ended up giving each select it's own unique ID and of course that works
just fine. 

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Josh Nathanson
Sent: Wednesday, May 23, 2007 2:26 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Question about the context attribute of a jQuery call


The OP has a case where there are two forms, each with its own ID, however,
the elements of each form are the same so there are duplicate ID's.

Perhaps this is not the best design pattern, and class or name could be used
for selection rather than IDs.  Or, set it up so the IDs are not duplicated.

-- Josh


- Original Message -
From: Daemach [EMAIL PROTECTED]
To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, May 23, 2007 11:46 AM
Subject: [jQuery] Re: Question about the context attribute of a jQuery call



 I think you can use a selector in a context attribute, but there isn't
 much point in this situation.  If all of your ID's are unique (and
 they should be), $('#make') is enough.  You don't need a context.
 When you use the #, it's the same as doing document.getElementByID();

 On May 23, 11:19 am, Sean Catchpole [EMAIL PROTECTED]
 wrote:
  $('#make','#redlineSelect').click( do something here)

 It's invalid to have a string as the second parameter to jQuery. Try
 this instead:
 $(#redlineSelect #make).click(...);

 ~Sean