This project has moved. For the latest updates, please go here.

How can select a div with classname contain "post"

Topics: User Forum
Sep 18, 2012 at 5:39 PM

hi, i want to  select  a div  which its  contain "post-1", "post-2", "post-3" is there any chance for me ?


<div id="post-405" class="post-405 post type-post status">

<div id="post-105" class="post-105 post type-post status">

<div id="post-5" class="post-5 post type-post status">



now i m using this but its cant get .


 HtmlNode Blog = doc.DocumentNode.SelectNodes(@"//div[@class="post"]))

Sep 18, 2012 at 9:58 PM

I'd recommend using the LINQ compatible functions

var results = doc.DocumentNode
                 .Where(x=>x.Attributes.Contains("class") &&
This will get a list of all divs that contain a the word post in the class attribute