0
JS表的link_to錨我有爲內容
<div><%= simple_format @chapter.body, id: "toc-container" %></div>
一個放映視圖一些JS
<script>
$headings = $("h2, h3");
$.each($headings, function(index, value){
$("#toc-container").append("<li>" + $(value).html() + "</li>");
});
</script>
的代碼創建的列表中H2和H3標頭,所述chapter.body上方。
如何讓列表link_to爲每個標頭定位?
這個伎倆。非常感謝您的幫助! – jgrant