Search code examples
javascripthtmlpughref

Jade/pug anchor tag newline confusion


I am using Jade/Pug and I want the following "a" tag to appear on the same line as the preceding "p" tag text but whatever I do the link always appears underneath the text. How can I stop this?

for option in responseBody.options
    p
        |#{option.courseType}
        |#{option.subject}
        a(href='/formdash/{responseBody.formId}/{responseBody.studentId}/{option._id}/options') Delete

Solution

  • Not sure exactly where your issue lies, because I've tried to reproduce this with a CodePen, but it works as expected there... For reference, this is what I constructed to try to reproduce your issue:

    for i in [1, 2, 3]
    p
        |#{i}
        |#{i}
        a(href='#') Delete