Problem debugging script $(this).find is not a function
<p>I'm having a problem debugging this script, the initial problem was “$().ready is not a function” so I wrapped this part of the script:</p>

<pre><code>$(document).ready(function()
{   $('#jsddm &gt; li').bind('mouseover', jsddm_open);
    $('#jsddm &gt; li').bind('mouseout',  jsddm_timer);});

document.onclick = jsddm_close;
</code></pre>

<p>Up like so </p>

<pre><code> ( function($) { 
  $(document).ready( function() { 

  $('#menu-main-nav &gt; li').bind('mouseover', jsddm_open);
  $('#menu-main-nav &gt; li').bind('mouseout',  jsddm_timer);
   });

  document.onclick = jsddm_close;

 } ) ( jQuery );
</code></pre>

<p>But I now get a $(this).find is not a function on the line "jsddm_close();" - any help appreciated, I'm sure it's something simple. Full script as follows: </p>

<pre><code>&lt;script type="text/javascript"&gt;
    var timeout         = 500;
    var closetimer      = 0;
    var ddmenuitem      = 0;

    function jsddm_open()
    {   jsddm_canceltimer();
        jsddm_close();
        ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');}

    function jsddm_close()
    {   if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

    function jsddm_timer()
    {   closetimer = window.setTimeout(jsddm_close, timeout);}

    function jsddm_canceltimer()
    {   if(closetimer)
        {   window.clearTimeout(closetimer);
            closetimer = null;}}

    ( function($) {

            $(document).ready( function() { 

            $('#menu-main-nav &gt; li').bind('mouseover', jsddm_open);
    $('#menu-main-nav &gt; li').bind('mouseout',  jsddm_timer);

    });

    document.onclick = jsddm_close;

    } ) ( jQuery ); 

&lt;/script&gt;
</code></pre>
