Actually, you may want to avoid using custom attributes (expandos), problems
with this were discussed yesterday:

-------------------------------------------------------------------------------------------------
Err no, actually "*expandos*" refers to "non-standard" attributes that
get added to DOM elements. They "expand" the attributes that are
available on an element.

For instance adding an "*expando*" attribute called "hello":

   <input type="submit" value="blah" hello="Hello world!">

Because they're "non-standard" they can cause memory leak problems
under Internet Explorer if they refer to other DOM elements.

More info here:

   http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/*
expando*.asp<http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/expando.asp>

Karl Rudd
-------------------------------------------------------------------------------------------------------

- jake


On 3/2/07, Glen Lipka <[EMAIL PROTECTED]> wrote:

You might want to avoid using IDs and use a class instead.
Like <select class="foo"> or use an attribute like <select
bindtome="true">
Then $("select.foo"). or $("select[bindtome=true]") will bind to multiple.

Additionally, you dont have to bind the actual code there, you could call
a seperate function.
Lastly, you could use the 'each" if the code you want to bind is different
depending on circumstances.

"Each" allows you to bind the code one at a time and make adjustments.

Check www.jquery.com/api for cut/paste examples.  Hope this helps.

Glen


On 3/2/07, dan j <[EMAIL PROTECTED]> wrote:
>
>
> Apologies if this has been answered elsewhere, but I couldn't find an
> answer
> by searching.
>
> I suppose this is a newbie question. Is it possible to assign the same
> function to multiple elements with different id's with one call?
>
> For example, with the code below, could I assign the onchange handler to
>
> another element with a different id?
>
> $(document).ready(function() {
>   // apply onchange handler to 'time' field
>   $("select#time").change(function(){
>     // send request with amount & date as variables
>         $.post("guestCheck.php", {time: $(this).val(), date:
> $("select#date").val()}, function(xml) {
>     //assign callback XML to JavaScript variable
>         var guests = $("guests",xml).text();
>         alert (guests);
>        });
>   });
>
> Thanks for any advice.
> --
> View this message in context: 
http://www.nabble.com/multiple-elements%2C-one-function-tf3332805.html#a9267242
>
> Sent from the JQuery mailing list archive at Nabble.com.
>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to