通过JQuery属性传递输入

时间:2014-04-03 20:10:12

标签: javascript jquery attributes linkedin

我有一个我的网站从LinkedIn获取的价值。我想将此值作为我运行的脚本的属性传递。我的代码不正确,因为它只是一个解决方案中的黑暗镜头。关于如何使这个功能的任何建议?

<input type="hidden" name="linkedin-id"  value="<?js= id ?>" id = "person"/>
    <script>
      $( document ).ready(function() {
        $( "#test" ).attr({
          'data-ids': $("#person").val(),
        });
      });
    </script>

1 个答案:

答案 0 :(得分:0)

如果您确保导入jquery库等,

在代码中看不到任何错误

<input type="hidden" name="linkedin-id"  value="<?js= id ?>" id = "person"/>
    <script type="text/javascript">
      $( document ).ready(function() {
        $( "#test" ).attr({
          'data-ids': $("#person").val(),
        });
      });
    </script>
相关问题