Why Cant add a class to an element by jquery
Going on little information provided its probably because you cannot access jQuery with the $ by default in drupal.  This is to prevent other library conflicts (see jQuery.noConflict())  If this is the case you will probably be getting an undefined function error in your console.  To fix this you can either use jQuery or wrap it in a function like this:

(function($){
  $(".play").attr("id", "myID");
})(jQuery);


or can do this:

jQuery(".play").attr("id", "myID");


By default the version of jQuery that is used on drupal is 1.5.  You may consider using jQuery Update module for a newer version.

"Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery's case, $ is just an alias for jQuery, so all functionality is available without using $. If you need to use another JavaScript library alongside jQuery, return control of $ back to the other library with a call to $.noConflict(). Old references of $ are saved during jQuery initialization; noConflict() simply restores them."