[jQuery] How to access an iFrame ID from within

[jQuery] How to access an iFrame ID from within


Sorry if report....
I have an iFrame
<iframe id="myframe" src="index.php"></iframe>
it loads a content, how can I access the iFrame ID, which is "myframe"
from inside index.php?
I have tried:
//index.php
jQuery(document).ready(function() {
alert(jQuery('#myframe').attr('id'));
});
but not succeed.