I want to change HTML dir
attribute once the page loads; how can I do that? Do I need to use the .ready()
function?
Currently it looks like:
jQuery("html[lang=ar]").attr("dir", "rtl")
.find("body").addClass("right-to-left");
How can I write it in a script; do i need to write in .ready()
function or .load()
?
<div class="header">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
jQuery("html").attr("dir", "rtl")?
</script>
The code appears like this:
This is my CSS
body.right-to-left li {
float:right;
direction: rtl;
}
simple as it can be...
put your code inside...document.ready()
<script>
$(document).ready(function(){
$("html[lang=ar]").attr("dir", "rtl")
.find("body").addClass("right-to-left");
});
</script>
and a link that explain about ready()
and load()
function..
http://4loc.wordpress.com/2009/04/28/documentready-vs-windowload/