Actually it was my problem, not Giuliano's.  And I failed to mention an
important fact, that I only get the error when my HTML does not include the
element I'm selecting for.  Also it has gotten weirder, because now I'm
getting the same error with previous versions of jQuery, even though I know
I never saw it until I upgraded.

Jennifer


Hi Giuliano,

I tried to reproduce your problem, but both types of selectors worked  
fine for me.

I used jQuery 1.1.1 packed (Rev. 1173).

You can see the test here:
http://test.learningjquery.com/ids.htm

Here is the relevant script and css placed in the <head>:

   <script type="text/javascript">
     $(document).ready(function() {

       $('#main-content #first-para').addClass('test1');

       $('div#second-para').addClass('test2');

     });
   </script>

        <style type="text/css" media="screen">
         .test1 {
           background: #ff9;
         }
         .test2 {
           background: #cff;
         }
        </style>

And here is the relevant HTML:

<div id="main-content">
   <h2>ID Issues?</h2>
   <div id="wrapper">
   Using jQuery 1.1.1 Rev. 1173, packed.
     <div id="first-para">
       <p>Applied selector: <code>$('#main-content #first-para')</ 
code>, should make the div's background yellow. </p>
     </div>
   </div>
   <div id="second-para">
     <p>Applied selector: <code>$('div#second-para')</code>, should  
make the div's background light blue.</p>
   </div>
</div>




--Karl
_________________

-- 
View this message in context: 
http://www.nabble.com/simple-selector-with-ID-doesn%27t-work-anymore-tf3080046.html#a8640954
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to