admin管理员组文章数量:1419191
I have the following Pug snippet and I'm trying to show a URL inside one of the td
tags. However, when I run this the resulting output is displaying a(href=val.url+'/update')
followed by the correct #{val.name}
. How do I go about telling Pug that the value inside the td
tag is a link and that #{val.name}
should be the hyperlink? If I remove the table and display the href
tag inside a p
tag it works fine.
extends layout
block content
h1= title
table.table.table-condensed
thead
tr
th Name
th Date Created
th Date Modified
th Ready for Hire
tbody
each val in list_genres
tr
td a(href=val.url+'/update') #{val.name}
td #{val.date_created}
td #{val.date_created}
td No
else
li There are no candidates.
I have the following Pug snippet and I'm trying to show a URL inside one of the td
tags. However, when I run this the resulting output is displaying a(href=val.url+'/update')
followed by the correct #{val.name}
. How do I go about telling Pug that the value inside the td
tag is a link and that #{val.name}
should be the hyperlink? If I remove the table and display the href
tag inside a p
tag it works fine.
extends layout
block content
h1= title
table.table.table-condensed
thead
tr
th Name
th Date Created
th Date Modified
th Ready for Hire
tbody
each val in list_genres
tr
td a(href=val.url+'/update') #{val.name}
td #{val.date_created}
td #{val.date_created}
td No
else
li There are no candidates.
Share
Improve this question
asked Sep 13, 2017 at 16:18
Matthew SnellMatthew Snell
9573 gold badges12 silver badges27 bronze badges
2
-
Have you tried to put the
a
-element on a new line below, with an extra indent? AFAIK, Pug interprets any code that directly follows a tag on the same line as text. – gandreadis Commented Sep 13, 2017 at 18:46 -
1
Brilliant! That makes sense now that I've seen
p
tags written with text on the new line. – Matthew Snell Commented Sep 13, 2017 at 18:54
1 Answer
Reset to default 7Thanks to @gandreadis, the solution is below. Any text seen after recognized code (in this case td
) is interpreted as text only. A new line is needed.
extends layout
block content
h1= title
table.table.table-condensed
thead
tr
th Name
th Date Created
th Date Modified
th Ready for Hire
tbody
each val in list_genres
tr
td
a(href=val.url+'/update') #{val.name}
td #{val.date_created}
td #{val.date_created}
td No
else
li There are no candidates.
本文标签: javascriptDisplaying URL inside table tdPugJadecurrently only displaying as textStack Overflow
版权声明:本文标题:javascript - Displaying URL inside table td - PugJade - currently only displaying as text - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745303446a2652510.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论