Loading youtube videos by its URL with the help of a JS/Jquery function
<p>I am trying to load youtube videos using JS function. The intention is to have the user simply copy and paste the youtube video URL into an input field and then have my JS code takes care of the loading part. Unfortunately I am not sure why js code is not loading anyvideo? <a href="http://jsfiddle.net/bullseye2346/fZsrs/" rel="nofollow">JS FIDDLE</a></p>

<p>JS:</p>

<pre><code>&lt;script&gt;
       $(document).ready(function(){
        var last_cnad_text_1 = '';
        var options_cnad_text_1 = {
        embedMethod:'fill',
        maxWidth:320,
        maxHeight: 320
        };
        function loadVideo()
        {
        val = $('#cnad_text_1').val();
        if ( val != '' &amp;&amp; val != last_cnad_text_1 )
        {
        last_cnad_text_1 = val;
        $("#embed_cnad_text_1").oembed(val,options_cnad_text_1);
        }
        }
        $(function(){
        $('#cnad_text_1').keydown(loadVideo());
        $('#cnad_text_1').click(loadVideo());
        $('#cnad_text_1').change(loadVideo());
        });
        });
​&lt;/script&gt;
</code></pre>

<p>html:</p>

<pre><code>&lt;html&gt;

&lt;div class="col1"&gt;Insert a youtube video Link&lt;/div&gt;
   &lt;div class="col2"&gt;
   &lt;input id="cnad_text_1" type="text" name="cnad[text_1]"&gt;
   &lt;div id="embed_cnad_text_1"&gt;
   &lt;iframe&gt;&lt;/iframe&gt;
    &lt;/div&gt;
&lt;/div&gt;​

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