I have created a function outside of $(document).ready(), but am still using jQuery inside of it. For example:
testFunction(){
$('#test').hide();
alert('test');
}
When I call testFunction() after the page has completely loaded, #test is not hidden but I do see the alert.
What must I do in order to use jQuery inside of this function? Thanks!
UPDATE:
Good to understand there are no restrictions for working outside $(document).ready().
Here's why it's not working: I am not calling testFunction(), I am calling parent.testFunction() from an iframe and #test is in the parent frame. So... I guess I cannot use '#test' as a selector. What should I be using?