1

My page structure is like

I have a html page which consist of a jQuery Dialog. Within the jQuery Dialog a screen opens within iFrame.

Now the problem I am facing is - I want to close jQuery Dialog by clicking a button within iFrame. (For e.g. If my iFrame source is Google.com, then on click of search button my dialog box should close)

So, Can I write close call handling click event of search button in $(document).ready(function() of my html page?

Note :- iframe source is not accessible.

If no, then what are the other possible option to do it?

Thanks in Advance.

niksvp
  • 5,545
  • 2
  • 24
  • 41

2 Answers2

1

If the iFrame source is on a different domain than you cannot do this.

Options

  • Use the Dialog's built in close functionality

  • If the position of your item that you want to trigger the close is fixed, you can overlay a div covering. Fire the close event on the clicking of the div. http://jsfiddle.net/YvbPB/

jon3laze
  • 3,188
  • 6
  • 36
  • 69
  • Thanks, a good suggestion, yet I want something different, as if I overlap the position of the search button may vary and look of the page would be disturbed. – niksvp Mar 30 '11 at 08:04
0

See jQuery/JavaScript: accessing contents of an iframe my friend.

Community
  • 1
  • 1
Levi Morrison
  • 19,116
  • 7
  • 65
  • 85