2016-08-16 54 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> 
相關問題