Are you aware that the information you were looking it is outdated, e.g refers to jQuery 1.1.2? With the latest version you would use:
$('p:has(a)') --Klaus On 4 Okt., 12:29, Puneet Arora <[EMAIL PROTECTED]> wrote: > Hi All, > > In the following code, I expect the document to pop a message box > saying 'para1' upon load. However it doesn't seem to work. I am trying > to select a 'p' element that has a link in it. What do u think is > wrong ? > > -- > <html> > <head> > <script type="text/javascript" > src="starterkit/jquery-1.2.6.js"></ > script> > <script type="text/javascript"> > $(document).ready(function() { > $("p[a]").each(function() { > alert(this.id) > }); > }); > </script> > </head> > <body> > <p id='para1' class='haha'> > <a id='para1_a1' href="http://jquery.com/">jQuery</a> > </p> > <p id='para2'> > <span>This is a span in para2</span> > </p> > </body> > </html> > --- > > $("p[a]") should select all paragraphs that have a link in them, which > is true for para1 > (I got this selector > from:http://docs.jquery.com/DOM/Traversing/Selectors#Using_CSS_and_XPath_T...) > > thanks, > > regards, > Puneet