jQuery - Iframe validation - cannot get values

Posted by Henry on Stack Overflow See other posts from Stack Overflow or by Henry
Published on 2010-05-21T02:52:41Z Indexed on 2010/05/21 3:00 UTC
Read the original article Hit count: 397

Filed under:
|
|

See demo: http://tinyurl.com/3xow97t

The editor is under development. Now we check if it has an value - this works well with all form fields that have the class .required... but it does not work with the iframe.

the iframe has a div with id #content.

$('form .meet').focus(function() {
    $('iframe').each(function() {
    ** if($(this).contents().find('#content').val() == '') { **
        $(this).addClass('warning');
    }
    })
});

That means it should add the class .warning if the iframe is empty. But it always does, so what am i doing wrong?

Does it not work, because the JS does not see the text i currently typed in? ^^

Regards Henry

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about iframe