通过jquery选择器访问iframe中的变量

我有以下内容:

  variable='hi';   

我需要知道如何通过jquery选择器从顶部窗口访问变量,如$(“#test”)。变量?

你可以试试 :

 $("#test")[0].contentWindow.variable;