title: Dynamically add class to img tag from entire HTML
body: <p>I have an rich editor which adds text and images,to make the images responsive </p>
  
  <pre><code>class="img-thumbnail"
  </code></pre>
  
  <p>is needed in all the image tags,so have used HtmlAgility pack to extract image tags from entire Html but how to add the class on each image tag.</p>
  
  <p>Example</p>
  
  <p>Input from html after extracting image tag</p>
  
  <pre><code>&lt;img src="http://domain.com/images/image1.jpg"&gt;
  </code></pre>
  
  <p>Expected</p>
  
  <pre><code>&lt;img src="http://domain.com/images/image1.jpg" class="img-thumbnail"&gt;
  </code></pre>
  
  <p>Code</p>
  
  <pre><code> public string ParseImage(string pHtml)
      {
  
          HtmlDocument doc = new HtmlDocument();
          doc.LoadHtml(pHtml);
          var imgs = doc.DocumentNode.SelectNodes("//img");
  
          foreach (var item in imgs)
          {
              string orig = item.Attributes["src"].Value;
              //Add class to each img tag.
          }
        }
  </code></pre>