How to access thickbox parent elements

174 Views Asked by At

I'm trying to access a thickbox iframe parent's element, I found similar questions but none of solutions is working for me. Here's the code of parent window:

<input type="text" id="mname" value="" name="mname" class="form-control" length="30" size="15" required>        

and here's iframe code:

<script type="text/javascript">
    $(document).ready(function () {
        $("#mname", top.document).attr("value", "test");//Not working
        $("#mname", parent.window.document).attr("value", "test");//Not working
        $('#mname', top.document).val('Test');//Not working
        $('#mname', parent.document.body).attr("value", "s");//Not working
        window.parent.$("#mname").attr("test");//Not working
        alert(":(");
        parent.tb_remove();
    });
</script>

What's the problem?

1

There are 1 best solutions below

0
Carlos Delgado On

Try with :

<input type="text" id="mname" value="" name="mname" class="form-control" length="30" size="15" required>
<script>
$("#mname", window.parent.document).val();
</script>