On May 30, 2007, at 10:53 AM, SeViR wrote:
#id .class <- get the element with id "id" only if has the class
"class" but..
.class #id ¿?¿?¿? If you can get the element with id "id", why
don't you select directly? #id
The id is unique so you don't need preselect a class first. Also,
if you want select the element #id
and all the elements .class, then ".class, #id" works.
This paragraph from the reference section of the upcoming Learning
jQuery book might help explain why someone would want or need to
preselect a class first. It discusses specifying a tag name rather
than a class, but the same principle applies:
It might not be immediately clear why someone might want to specify
a tag name associated with a particular id, since that id needs to
be unique anyway. However, some situations in which parts of the
DOM are user-generated may require a more specific expression to
avoid false positives. Furthermore, when the same script is run on
more than one page, it might be necessary to identify the id's
element, since the pages could be associating the same id with
different elements. For example, Page A might have <h1 id='title'>
while Page B has <h2 id='title'>.
As to the bug -- Luc, what version of jQuery are you using? I seem to
recall this bug being fixed at some point, though my memory could be
deceiving me.
If you test it with 1.1.3a and it still produces the error, perhaps
you could log it in the bug tracker?
http://jquery.com/dev/bugs/new/
thanks,
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com