You should wrap your string in '?
so your code would be
$('span[class*='mycategory'"],xml).length

cheers

Michael Lawson
Content Tools Developer, Global Solutions, ibm.com
Phone:  1-919-517-1568 Tieline:  255-1568
E-mail:  mjlaw...@us.ibm.com

'Examine my teachings critically, as a gold assayer would test gold. If you
find they make sense, conform to your experience, and don't harm yourself
or others, only then should you accept them.'


                                                                       
  From:       ml1 <tsummer...@gmail.com>                               
                                                                       
  To:         "jQuery (English)" <jquery-en@googlegroups.com>          
                                                                       
  Date:       02/16/2009 11:08 AM                                      
                                                                       
  Subject:    [jQuery] "class" weirdness in loaded XML?!?              
                                                                       






I have something very strange going on trying to create a wrapped set
of elements from an xml file loaded via jquery's xmlhttprequest.   The
xml has a number of entries with class attributes that have multiple
values, ie <span class="mycategory mychoice" ...>...</span>

When I use this selector:

   $('span[class*=mycategory"],xml).length

jquery returns zero.  Weirdly if I do exactly the same thing but use a
different attribute name from "class" in the xml and the query, it
works perfectly.

If I use this method I get the expected result:

   $('span').attr('class')

It returns "mycategory mychoice"

Is there something special about the "class" attribute in xml that is
causing this?

<<inline: graycol.gif>>

<<inline: ecblank.gif>>

Reply via email to