I have two iframes in my html page in the same domain
<iframe id="i1" width="100%" height="100%" src="/wordpress"></iframe></th>
<iframe id="i2" width="100%" height="100%" src="/wordpress"></iframe></th>
I have given the click event for the a tag inside the iframe from where i am getting the path of the clicked element in the parent iframe
$('a').click(function(e){
var path = $(this).getPath();
var ahash={
'path':path
};
if (getFrameElement())
window.parent.document.Aaddevent(e, ahash);
});
I now want to use this path and trigger the click event in other iframe so that both iframe have the same page view. I am using the path in second iframe from the click event of parent iframe in the following way:
var iframes= parent.document.getElementsByTagName('iframe');
for (var i= iframes.length; i--;) {
var iframe= iframes[i];
if($(iframe)){
if (ahash.path!=undefined) {
$(iframe).click(function(e) {
$(this).find(ahash.path).trigger('click');
}).click();
$(iframe).unbind('click');
}
}
}
The problem i am facing now is i am getting the alert for the click event getting triggered in the second iframe but it is not loading the path of the parent iframe and opening the same content as parent iframe.
I am not understanding where i am doing the mistake. Is it possible to do the way i am tring to make it happen? If so can anyone suggest me why this is happening and what i need to do so that the other iframe opens the content using the path of the parent iframe from the click event in the parent iframe.