How to close an iframe within iframe itself
Use this to remove iframe from parent within iframe itself
frameElement.parentNode.removeChild(frameElement)
It works with same origin only(not allowed with cross origin)
function closeWin() // Tested Code
{
var someIframe = window.parent.document.getElementById('iframe_callback');
someIframe.parentNode.removeChild(someIframe));
}
<input class="question" name="Close" type="button" value="Close" onClick="closeWin()" tabindex="10" />
"Closing" the current iFrame is not possible but you can tell the parent to manipulate the dom and make it invisible.
In IFrame:
parent.closeIFrame();
In parent:
function closeIFrame(){
$('#youriframeid').remove();
}