【问题标题】:Adding dymatic data into phonegap plugin将动态数据添加到 phonegap 插件中
【发布时间】:2015-06-18 01:09:16
【问题描述】:

我正在尝试将数据动态添加到 phonegap 插件中

<a href="#" onclick="window.plugins.socialsharing.share(
   null, 
   null, 
   'document.getElementById('setquote').innerHTML;', 
   null
)">

我曾尝试使用此document.getElementById('setquote').innerHTML; 将数据导入插件,但没有成功。

【问题讨论】:

    标签: javascript android jquery cordova phonegap-plugins


    【解决方案1】:

    我认为你不需要引号:

    <a href="#" onclick="window.plugins.socialsharing.share(
       null, 
       null, 
       document.getElementById('setquote').innerHTML,  <- remove quotes here
       null
    )">
    

    当您将该行用引号括起来时,您只是在传递一个字符串,我认为您想传递实际的内部 html

    【讨论】:

    • @kingv 好的,在这种情况下,我猜你的 innerHTML 包含 " 字符。这可能会转义你的字符串。你能用 innerHTML 更新你的问题吗?
    • 搞定了,忘了去掉innerHTML末尾的;。感谢@jasonscript 的帮助
    • 这个脚本非常有用,但我看到的问题是共享包含 html 属性的消息,例如。

      等等

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-28
    • 2013-10-07
    • 2017-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多