title: Get every ID from every DIV with a specific class
body: <p>I'm working on a website which has multiple news articles in it's homepage. I have a function which removes letters if the news article contains more than 300 characters. A hyperlink "read more" will show up so the reader can read the full article. Once the reader clicks on Read More, he/she will be redirected to a link containing the article ID in it. For example: index.php?newsid=73 </p>
  
  <p>However, I need to give every DIV the ID of the ID of the news article. This isn't really much of a problem, the problem is: How would I get jQuery to get the ID of the div to give every hyperlink it's own URL?</p>
  
  <p>My current code:</p>
  
  <pre><code>        $(document).ready(function(){
      var myDiv = $('.content');
      var abc = $(this).closest(".content").attr("id");
          //var myDiv = $('.content').attr('class');
          //var myDiv = $('#content');
          //myDiv.html(myDiv.text().substring(0,300) + '&lt;a href="#"&gt;Read more&lt;/a&gt;');
      })(jQuery);
  </code></pre>
  
  <p>I commented a couple of lines just to test it. My code obviously doesn't work and I am kinda lost. This is how I give every div it's own ID:</p>
  
  <pre><code>echo "&lt;div class='content' id='" .$myrow['id'] ."'&gt;" .$myrow['content']. "&lt;/div&gt;";
  </code></pre>