title: Change html dir attribute using jQuery
body: <p>I want to change HTML <code>dir</code> attribute once the page loads; how can I do that? Do I need to use the <code>.ready()</code> function?
  Currently it looks like:</p>
  <pre><code>jQuery(&quot;html[lang=ar]&quot;).attr(&quot;dir&quot;, &quot;rtl&quot;)
              .find(&quot;body&quot;).addClass(&quot;right-to-left&quot;);
  </code></pre>
  <p>How can I write it in a script; do i need to write in <code>.ready()</code> function or <code>.load()</code>?</p>
  <pre><code>&lt;div class=&quot;header&quot;&gt;
  &lt;script src=&quot;http://code.jquery.com/jquery-latest.js&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
  jQuery(&quot;html&quot;).attr(&quot;dir&quot;, &quot;rtl&quot;)?
  &lt;/script&gt;
  </code></pre>
  <p>The code appears like this:</p>
  <p>This is my CSS</p>
  <pre><code>body.right-to-left li {
      float:right;
      direction: rtl;
  }
  </code></pre>