For example, how to select elements of this type on the page:

<a href="#"><span class="icon"><span>Sometext</a> 

those. It is necessary to select all elements a, containing in itself a span element with a class info?

  • you have something with HTML markup, the a tag closes earlier than the spans attached to it - GLAGOLA

2 answers 2

 $('a:has(span.info)'); 
  • For sure! Thank. :) - xhr
 alert($('a .icon').html()); 
  • No it's not that. This will select elements with a class of icon, nested in elements of a. - xhr