2016-08-16 32 views
1

我需要在div标记中指定属性data-*,我该如何做? 我想是这样的,但它不工作:如何用标签函数中的破折号指定属性?

tags$div(id='log', data-log='value') 
+1

在R您需要使用反单引号,以获得包含破折号或领先数字的名字。我不知道这是否成功与Shiny,但至少它不会呛解析器,这可能是你现在陷入困境的地方。 –

回答

1

引用属性会的工作!

tags$div(id='log',class='unique','data-log'='next') 

输出(HTML源代码):

<div class="col-sm-8"> 
     <div id="distPlot" class="shiny-plot-output" style="width: 100% ; height: 400px"></div> 
     <div id="log" class="unique" data-log="next"></div> 
     </div> 
相关问题