【问题标题】:How to correctly enter the data-target id in php echo如何在 php echo 中正确输入数据目标 ID
【发布时间】:2016-03-31 17:51:21
【问题描述】:

我正在尝试打开一个包含产品图像和信息的引导模式窗口。我的问题似乎是数据目标中的#uoc-modal。有人可以告诉我如何在回显中正确输入数据标签 ID 吗?

echo '<a "data-toggle='modal'", "data-target='#uoc-modal'" href="' . get_the_permalink() . '">';

【问题讨论】:

    标签: php twitter-bootstrap modal-dialog echo


    【解决方案1】:

    从您的问题代码中,您应该将其转义

    echo '<a "data-toggle=\'modal\'", "data-target=\'#uoc-modal\'" href="\' . get_the_permalink() . \'">';
    

    但是,我认为这应该可行

    echo '<a data-toggle="modal" data-target="#uoc-modal" href="'.get_the_permalink().'">Modal</a>';
    

    但无论如何,&lt;a&gt; 元素不需要 data-target 属性。只需改用href

    【讨论】:

    • 谢谢,我的原始代码中有一个额外的逗号使其无法正常工作。转义无效,无法获得永久链接
    【解决方案2】:

    试试这个代码:

    echo '<a "data-toggle=\'modal\'", "data-target=\'#uoc-modal\'" href="\' . get_the_permalink() . \'">';
    

    晚上好

    【讨论】:

      猜你喜欢
      • 2013-09-16
      • 1970-01-01
      • 2013-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-12
      相关资源
      最近更新 更多