bayyinah
bayyinah

Reputation: 139

$(this) equivalent in CsQuery

is there equivalent for $(this) in csquery.. in below example letterbody string has html content. i want to prepand text before each tag.

 var dom = CQ.Create(letterBody);
            CQ divs = dom.Select("p");


  divs.Each(
                (index, domCQ) =>
                {
                    index = index + 1;
                    divs.Prepend("<span>" + index++ + "</span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>");//how to access and prepand //to each selected divs..
                });

Upvotes: 0

Views: 86

Answers (1)

Benjamin Gruenbaum
Benjamin Gruenbaum

Reputation: 276306

Yes, it's the same as .Cq() in newer versions of CsQuery. IDOMElements have a .Cq() extension method that does it.

 domEl.Cq().Text(); // for example

Upvotes: 1

Related Questions