I have a certain number of div boxes that all have the same class name. I am trying to apply something to them all but have no luck. The code I constructed so far is
$(document).ready(function(){
elements = $('div.easy_editor');
elements.each(function() { $(this).css("border","9px solid red"); });
//elements[0].css("border","9px solid red");
});
Could you please tell me what I am doing wrong
You can try this
The
$('div.easy_editor')refers to a collection of all divs that have the class easy editor already. There is no need to use each() unless there was some function that you wanted to run on each. The css() method actually applies to all the divs you find.