Q:

JQuery Get Value of input in iframe page returning Object

I am trying to get the value of an input which is in an iframe.
When I submit the form I'm getting the alert telling me it's been submitted but when I try to get the value of the input it's alerting Object instead of the value.
Here is the code:
$(document).ready(function() {
    $('#myiframe').load(function() {
        $(this).contents().find('#myiframe').submit(function() {

            $res = $("#myiframe").contents().find('input[name="subject"]');

            alert('Form HAS been submitted'); //This works

            alert($res); // returns Object Object

            return true;
        });
    });

});

What I'm I doing wrong here?

A:

$res is a jquery object. You need to get the value using .val() inorder to alert the value.
$(document).ready(function() {
    $('#myiframe').load(function() {
        $(this).contents().find('#myiframe').submit(function() {

            $res = $("#myiframe").contents().find('input[name="subject"]');

            alert('Form HAS been submitted'); //This works

            alert($res.val()); // returns Object Object

            return true;
        });
    });

});

