jQuery - change html attr in iframe is that possible?

can i change the html dir attr inside an iframe after its loaded?
i tried doing it this way:

 $('#iframeid html').attr('dir','ltr');

but it didnt work…

You can’t manipulate the HTML of an iframe if the content is not from the same domain, this is prevented by the browser in order to counter cross site scripting. That would be the first place I’d look. The second is changing up your jQuery selection slightly:


var $html = jQuery('iframe').contents().find('html');
$html.attr('dir','ltr');

I can’t recall why this works off the top of my head, just that it does.