One of my HTML elements has the class "article":
<article> Content </article>
In my jQuery script, I want to add specific classes that have been predefined:
$('article').addClass('rounded box-shadow gradient-bright');
I have multiple articles and similar boxes throughout my webpage, so I need to ensure that any changes only need to be made in one place - within the JavaScript.
The question is, how can I use jQuery to achieve the best results? I don't want users to see gradual changes loading on the page (such as initially seeing a regular box, then it becoming rounded with a shadow later... they should see all changes at once).
So...
$(window).ready( /* add class */ ) ...
Or...
$(document).ready( /* add class */ ) ...
Or...
Perhaps without using the ready function, just /* add class */
Or maybe there is another solution?
Edit Change <div class="article">
to <article>
for formality ;) But this is just an example...