Search Results

Search found 1 results on 1 pages for 'jonthecoder2346'.

Page 1/1 | 1 

  • Youtube video on load through Jquery/JS

    - by jonthecoder2346
    My goal is to display a youtube video through a javascript function that will read the embedded code and load the video automatically in the div assigned. But I am not getting anything shown in the div assigned for the video. Is it because it has to be triggered by a button click? <script type="text/javascript"> 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 != '' && 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()); }); </script> <body> <input id="cnad_text_1" type="text" value="" size="60" name="cnad[text_1]"> <div id="embed_cnad_text_1"></div> </body> </html>

    Read the article

1