我想将值存储在jquery var中并将其传递 [英] i want to store a value in jquery var and pass it

查看:82
本文介绍了我想将值存储在jquery var中并将其传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,您可以从这里下载它: http://www.4shared .com/rar/XoaJijx5/var_pass.html

i have a script you can download it from here: http://www.4shared.com/rar/XoaJijx5/var_pass.html

问题出在index.html& scripts.js,看看并给我更改

the problem is in the index.html & scripts.js, look at and give me the change

我在两个文件中写了一条注释,以告知我需要什么

i write a comments in the two files to let know what i need

我需要将隐藏的输入值传递给scripts.js并将其存储在var中,并将其回显到youtube的ID网址中

i need to pass the hidden input value to scripts.js and store it in var and echo it in the id url of youtube

index.html中的问题:

the problem in index.html:

<div id="player"><input type="hidden" name="youtube-id" value="uyeJXKfAcpc" /></div>

推荐答案

所有代码都必须在$(document).ready函数中..像这样:

All of your code needs to be in $(document).ready function.. Like this:

$(document).ready(function() {
    //You can alternatively pass an object:
    $('#player').youTubeEmbed({
        video: 'http://www.youtube.com/watch?v=uyeJXKfAcpc',
        width: 640,
        // Height is calculated automatically
        progressBar: true // Hide the progress bar
    });

    var yid = $("input[name='youtube-id']").val();
    $('#player').youTubeEmbed({
        video: 'http://www.youtube.com/watch?v=' + yid,
        width: 640,
        // Height is calculated automatically
        progressBar: true // Hide the progress bar
    });
}); // THE END OF YOUR $(document).ready function

这篇关于我想将值存储在jquery var中并将其传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆