set a id for a div class in drupal Anyone help me how to set the id for a div class dynamically in code. Let suppose class name by group_left 

      &lt;div class-"group_left article_left"&gt;


I have to add a id attribute for this class "group_left article left"

I have used the java script to set the id but I can't.This is my code.

   var thediv = document.getElementByClassName(".group-left ");
    thediv.setAttribute("id", "pad_id");


There is any way API to add attribute id for a class in drupal.please help me.
You would be better off using jQuery:

(function($) {
  $(function() {
    // Grab the element with both group_left and article_left class and set an ID attribute.
    $('.group_left.article_left').attr('id', 'pad_id');
  });
})(jQuery);


It's worth checking that the element with both of those classes is unique on the page, if the same ID is added to more than one element then the document will become invalid and you might have problems with other javascript.