The string does not need to be wrapped in single quotation marks.
Also, why does the selector begin with a single quotation mark and end
with a double? Are these just typos in the emails?
Try this:
$('span[class*=mycategory]',xml).length
Just one set of single quotation marks, and the closing mark is to the
right of the closing bracket.
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Feb 16, 2009, at 11:15 AM, Michael Lawson wrote:
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.'
<graycol.gif>ml1 ---02/16/2009 11:08:46 AM---I have something very
strange going on trying to create a wrapped set
<ecblank.gif>
From: <ecblank.gif>
ml1 <tsummer...@gmail.com>
<ecblank.gif>
To: <ecblank.gif>
"jQuery (English)" <jquery-en@googlegroups.com>
<ecblank.gif>
Date: <ecblank.gif>
02/16/2009 11:08 AM
<ecblank.gif>
Subject: <ecblank.gif>
[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?