[英]Values not showing — embedded ruby within innerHTML of anchor tag
我有一個用於導航欄的嵌入式紅寶石布局文件。 錨標記的innerHTML包含一個嵌入的紅寶石代碼段,該字符串調用字符串的值。
<% text_var = "check string" %>
<a id="show_string" class="brand" ><% text_var %></a>
結果
如果我改為<a id="show_string" class="brand" >This is Plain Text</a>
那么它將顯示“ This is Plain Text”作為錨標記的標題。
嘗試
<a id="show_string" class="brand" ><%= text_var %></a>
您需要=符號才能顯示字符串
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.